← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14530: PBF Payment Adjustment

 

------------------------------------------------------------
revno: 14530
committer: samta bajpayee<samta.bajpayee@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-03-28 19:52:45 +0100
message:
  PBF Payment Adjustment
added:
  local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/
  local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/
  local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/GetOrganisationUnitForPaymentAction.java
  local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/GetPaymentAdjustmentDetailsAction.java
  local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/LoadPaymentAdjustmentDetailsAction.java
  local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/getPaymentAdjustmentList.vm
  local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/paymentAdjustment.js
  local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadPaymentAdjustment.vm
  local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/menuPayment.vm
modified:
  local/in/dhis-web-maintenance-pbf/src/main/resources/META-INF/dhis/beans.xml
  local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml
  local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/menu.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
=== added directory 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment'
=== added directory 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action'
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/GetOrganisationUnitForPaymentAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/GetOrganisationUnitForPaymentAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/GetOrganisationUnitForPaymentAction.java	2014-03-28 18:52:45 +0000
@@ -0,0 +1,120 @@
+package org.hisp.dhis.pbf.payment.action;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.pbf.api.Lookup;
+import org.hisp.dhis.pbf.api.LookupService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetOrganisationUnitForPaymentAction implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+    
+    private LookupService lookupService;
+    
+    public void setLookupService( LookupService lookupService )
+    {
+        this.lookupService = lookupService;
+    }
+
+    private DataSetService dataSetService;
+    
+    public void setDataSetService( DataSetService dataSetService )
+    {
+        this.dataSetService = dataSetService;
+    }
+    
+    
+    // -------------------------------------------------------------------------
+    // Input/output
+    // -------------------------------------------------------------------------
+    private String message;
+    
+    public String getMessage()
+    {
+        return message;
+    }
+    
+    private String orgUnitId;
+    
+    public String getOrgUnitId()
+    {
+        return orgUnitId;
+    }
+
+    public void setOrgUnitId( String orgUnitId )
+    {
+        this.orgUnitId = orgUnitId;
+    }
+
+    private List<DataSet> dataSets = new ArrayList<DataSet>();
+    
+    public List<DataSet> getDataSets()
+    {
+        return dataSets;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute() throws Exception
+    {
+        OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
+        
+        /* List<OrganisationUnit> organisationUnitList = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitWithChildren(organisationUnit.getId()) ) ;
+        for (OrganisationUnit org : organisationUnitList) 
+        {
+        	if(!dataSets.containsAll(org.getDataSets()))
+        	{
+        		dataSets.addAll(org.getDataSets());
+        	}
+		}
+        */
+        List<Lookup> lookups = new ArrayList<Lookup>(lookupService
+				.getAllLookupsByType(Lookup.DS_PBF_TYPE));
+
+		for (Lookup lookup : lookups) 
+		{
+			Integer dataSetId = Integer.parseInt(lookup.getValue());
+
+			DataSet dataSet = dataSetService.getDataSet(dataSetId);
+
+			dataSets.add(dataSet);
+		}
+        Collections.sort(dataSets);
+        
+       
+        System.out.println( dataSets.size() );
+        if ( dataSets.size() > 0 )
+        {
+            message = organisationUnit.getName();
+            return SUCCESS;
+            
+        }
+        else
+        {
+            message = organisationUnit.getName();
+            
+            return INPUT;
+        }
+
+    }
+
+}

=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/GetPaymentAdjustmentDetailsAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/GetPaymentAdjustmentDetailsAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/GetPaymentAdjustmentDetailsAction.java	2014-03-28 18:52:45 +0000
@@ -0,0 +1,109 @@
+package org.hisp.dhis.pbf.payment.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.constant.Constant;
+import org.hisp.dhis.constant.ConstantService;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.pbf.api.Lookup;
+import org.hisp.dhis.pbf.api.LookupService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetPaymentAdjustmentDetailsAction implements Action {
+
+	private final static String PAYMENT_ADJUSTMENT_LEVEL_ORG_GROUP = "PAYMENT_ADJUSTMENT_LEVEL_ORG_GROUP";
+	private final static String PAYMENT_ADJUSTMENT_AMOUNT_DE = "PAYMENT_ADJUSTMENT_AMOUNT_DE";
+
+	// -------------------------------------------------------------------------
+	// Dependencies
+	// -------------------------------------------------------------------------
+
+	private DataSetService dataSetService;
+
+	public void setDataSetService(DataSetService dataSetService) {
+		this.dataSetService = dataSetService;
+	}
+
+	private OrganisationUnitGroupService organisationUnitGroupService;
+	
+	public void setOrganisationUnitGroupService(
+			OrganisationUnitGroupService organisationUnitGroupService) {
+		this.organisationUnitGroupService = organisationUnitGroupService;
+	}
+
+	private LookupService lookupService;
+
+	public void setLookupService(LookupService lookupService) {
+		this.lookupService = lookupService;
+	}
+
+	private ConstantService constantService;
+
+	public void setConstantService(ConstantService constantService) {
+		this.constantService = constantService;
+	}
+
+	// -------------------------------------------------------------------------
+	// Input / Output
+	// -------------------------------------------------------------------------
+
+	private List<DataSet> dataSets = new ArrayList<DataSet>();
+
+	public List<DataSet> getDataSets() {
+		return dataSets;
+	}
+
+	private List<String> orgUnitList = new ArrayList<String>();
+	
+	public List<String> getOrgUnitList() {
+		return orgUnitList;
+	}
+
+	private String amountDEId;
+	
+	public String getAmountDEId() {
+		return amountDEId;
+	}
+	// -------------------------------------------------------------------------
+	// Action implementation
+	// -------------------------------------------------------------------------
+
+	
+
+	public String execute() throws Exception {
+		Constant orgUnitGrp = constantService
+				.getConstantByName(PAYMENT_ADJUSTMENT_LEVEL_ORG_GROUP);
+		
+		Constant paymentAmount = constantService
+		.getConstantByName(PAYMENT_ADJUSTMENT_AMOUNT_DE);
+		
+		amountDEId = paymentAmount.getValue()+"";
+
+		List<OrganisationUnit> organisationUnitList = new ArrayList<OrganisationUnit>(
+				organisationUnitGroupService.getOrganisationUnitGroup(
+						(int) orgUnitGrp.getValue()).getMembers());
+		
+		for(OrganisationUnit org : organisationUnitList)
+		{
+			orgUnitList.add( "\"" + org.getUid() + "\"" );
+		}
+
+		List<Lookup> lookups = new ArrayList<Lookup>(lookupService
+				.getAllLookupsByType(Lookup.DS_PBF_TYPE));
+
+		for (Lookup lookup : lookups) 
+		{
+			Integer dataSetId = Integer.parseInt(lookup.getValue());
+
+			DataSet dataSet = dataSetService.getDataSet(dataSetId);
+
+			dataSets.add(dataSet);
+		}
+		return SUCCESS;
+	}
+}
\ No newline at end of file

=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/LoadPaymentAdjustmentDetailsAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/LoadPaymentAdjustmentDetailsAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/LoadPaymentAdjustmentDetailsAction.java	2014-03-28 18:52:45 +0000
@@ -0,0 +1,170 @@
+package org.hisp.dhis.pbf.payment.action;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.hisp.dhis.attribute.AttributeValue;
+import org.hisp.dhis.constant.Constant;
+import org.hisp.dhis.constant.ConstantService;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+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.pbf.api.LookupService;
+import org.hisp.dhis.pbf.api.QualityMaxValue;
+import org.hisp.dhis.pbf.api.QualityMaxValueService;
+import org.hisp.dhis.pbf.api.TariffDataValue;
+import org.hisp.dhis.pbf.api.TariffDataValueService;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodType;
+
+import com.opensymphony.xwork2.Action;
+
+public class LoadPaymentAdjustmentDetailsAction
+    implements Action
+{
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private DataSetService dataSetService;
+
+    public void setDataSetService( DataSetService dataSetService )
+    {
+        this.dataSetService = dataSetService;
+    }
+
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
+    private DataElementCategoryService categoryService;
+
+    public void setCategoryService( DataElementCategoryService categoryService )
+    {
+        this.categoryService = categoryService;
+    }
+    
+    private DataValueService dataValueService;
+    
+    public void setDataValueService(DataValueService dataValueService) {
+		this.dataValueService = dataValueService;
+	}
+    
+    private TariffDataValueService tariffDataValueService;
+
+    public void setTariffDataValueService( TariffDataValueService tariffDataValueService )
+    {
+        this.tariffDataValueService = tariffDataValueService;
+    }
+
+
+    // -------------------------------------------------------------------------
+    // Input / Output
+    // -------------------------------------------------------------------------
+
+    private String orgUnitId;
+
+    public void setOrgUnitId( String orgUnitId )
+    {
+        this.orgUnitId = orgUnitId;
+    }
+
+    private String dataSetId;
+
+    public void setDataSetId( String dataSetId )
+    {
+        this.dataSetId = dataSetId;
+    }
+
+    private String periodIso;
+
+    public void setPeriodIso(String periodIso) {
+		this.periodIso = periodIso;
+	}
+
+	List<DataElement> dataElements = new ArrayList<DataElement>();
+
+    public List<DataElement> getDataElements()
+    {
+        return dataElements;
+    }
+
+    private SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );;
+
+    public SimpleDateFormat getSimpleDateFormat()
+    {
+        return simpleDateFormat;
+    } 
+    
+    private Map<String,String> quantityValidatedMap = new HashMap<String, String>();
+    
+    public Map<String, String> getQuantityValidatedMap() {
+		return quantityValidatedMap;
+	}
+
+    private Map<String,String> tariffDataValueMap = new HashMap<String, String>();
+    
+    public Map<String, String> getTariffDataValueMap() {
+		return tariffDataValueMap;
+	}
+    
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+	public String execute()
+        throws Exception
+    {
+        OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit(orgUnitId);
+        
+        DataSet dataSet = dataSetService.getDataSet(Integer.parseInt(dataSetId));
+        
+        Period period = PeriodType.getPeriodFromIsoString( periodIso );
+        
+        dataElements.addAll(dataSet.getDataElements());
+        
+        DataElementCategoryOptionCombo optionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
+        
+        for(DataElement de : dataElements)
+        {
+        	DataValue dataValue = dataValueService.getDataValue(de, period, organisationUnit, optionCombo );
+        	if(dataValue != null)
+        	{
+        		quantityValidatedMap.put(de.getUid(), dataValue.getValue());
+        	}
+        	else
+        	{
+        		quantityValidatedMap.put(de.getUid(), "");
+        	} 
+        	TariffDataValue tariffDataValue = tariffDataValueService.getTariffDataValue(organisationUnit, de, dataSet, period.getStartDate(), period.getEndDate());
+        	
+        	if(tariffDataValue != null)
+        	{
+        		tariffDataValueMap.put(de.getUid(), tariffDataValue.getValue()+"");
+        	}
+        	else
+        	{
+        		tariffDataValueMap.put(de.getUid(), "");
+        	}
+        }
+        
+        return SUCCESS;
+    }
+}
\ No newline at end of file

=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-maintenance-pbf/src/main/resources/META-INF/dhis/beans.xml	2014-03-14 11:22:16 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/resources/META-INF/dhis/beans.xml	2014-03-28 18:52:45 +0000
@@ -238,6 +238,29 @@
 		<property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
 	</bean>
 	
+	<!-- Payment Adjustment -->
+	
+	<bean id="org.hisp.dhis.pbf.payment.action.GetOrganisationUnitForPaymentAction" class="org.hisp.dhis.pbf.payment.action.GetOrganisationUnitForPaymentAction" scope="prototype">
+        <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+        <property name="lookupService" ref="org.hisp.dhis.pbf.api.LookupService" />
+        <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+    </bean>
+	
+	<bean id="org.hisp.dhis.pbf.payment.action.GetPaymentAdjustmentDetailsAction"  class="org.hisp.dhis.pbf.payment.action.GetPaymentAdjustmentDetailsAction" scope="prototype">
+		<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+		<property name="organisationUnitGroupService" ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
+		<property name="lookupService" ref="org.hisp.dhis.pbf.api.LookupService" />        	
+        <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />		
+	</bean>
+	
+	<bean id="org.hisp.dhis.pbf.payment.action.LoadPaymentAdjustmentDetailsAction"  class="org.hisp.dhis.pbf.payment.action.LoadPaymentAdjustmentDetailsAction" scope="prototype">
+		<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+		<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+		<property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
+		<property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
+		<property name="tariffDataValueService" ref="org.hisp.dhis.pbf.api.TariffDataValueService" />
+	</bean>
+	
 	<!-- Save Quality Data -->
 	
 	<bean id="org.hisp.dhis.pbf.quality.dataentry.SaveDataValueAction"  class="org.hisp.dhis.pbf.quality.dataentry.SaveDataValueAction" scope="prototype">
@@ -337,16 +360,7 @@
         class="org.hisp.dhis.pbf.aggregation.action.GetAggregationQueryAction"
         scope="prototype">
         <property name="aggregationConditionService" ref="org.hisp.dhis.caseaggregation.CaseAggregationConditionService" />
-    </bean>	
-	
-	
-	
-	
-	
-	
-	
-	
-	
+    </bean>
 	
 	 <!-- Get All Lookups -->
     

=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml'
--- local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml	2014-03-14 11:22:16 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml	2014-03-28 18:52:45 +0000
@@ -171,6 +171,27 @@
 			/dhis-web-maintenance-pbf/status.vm</result>
 		<param name="onExceptionReturn">plainTextError</param>					
 	</action>
+		
+	<!-- Payment Adjustment Screen -->
+	<action name="getOrganisationUnitForPayment" class="org.hisp.dhis.pbf.payment.action.GetOrganisationUnitForPaymentAction">
+        <result name="success" type="velocity-json">/dhis-web-maintenance-pbf/jsonResponseSuccess.vm</result>
+        <result name="input" type="velocity-json">/dhis-web-maintenance-pbf/jsonResponseInput.vm</result>
+    </action>
+    
+	<action name="getPaymentAdjustmentDetail" class="org.hisp.dhis.pbf.payment.action.GetPaymentAdjustmentDetailsAction">
+      <interceptor-ref name="organisationUnitTreeStack" />
+      <result name="success" type="velocity">/main.vm</result>
+      <param name="page">/dhis-web-maintenance-pbf/getPaymentAdjustmentList.vm</param>
+      <param name="menu">/dhis-web-maintenance-pbf/menuPayment.vm</param>
+      <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/paymentAdjustment.js</param>
+      <param name="stylesheets">css/dataentry.css</param>
+    </action>
+    
+	<!-- Load Payment Adjustment List -->
+	<action name="loadPaymentAdjustmentList" class="org.hisp.dhis.pbf.payment.action.LoadPaymentAdjustmentDetailsAction">
+		<result name="success" type="velocity">/content.vm</result>
+		<param name="page">/dhis-web-maintenance-pbf/loadPaymentAdjustment.vm</param>
+	</action>
 
     <!--  Aggregation Engine -->
     <action name="aggregationQueryList" class="org.hisp.dhis.pbf.aggregation.action.AggregationQueryListAction">

=== added file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/getPaymentAdjustmentList.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/getPaymentAdjustmentList.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/getPaymentAdjustmentList.vm	2014-03-28 18:52:45 +0000
@@ -0,0 +1,162 @@
+<script>
+    
+	jQuery(document).ready( function(){
+	countryTags = $orgUnitList;
+	currentDiv = 'paymentAdjustmentForm';
+	
+    }); 
+    function saveDataValue()
+    {
+    	var period = document.getElementById("selectedPeriodId").value;
+		var valueId = "amountAvail";
+	
+	var fieldId = "#"+valueId;
+	var defaultValue = document.getElementById(valueId).defaultValue;
+	var value = document.getElementById(valueId).value;
+	
+	if(defaultValue != value)
+	{
+	var dataValue = {
+        'dataElementId' : $amountDEId,        
+        'organisationUnitId' : $("#selectedOrgunitID").val(),
+        'periodIso' : period,
+        'value' : value
+    };
+	    jQuery.ajax( {
+	            url: 'saveDataValue.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_GREEN );
+	}
+
+	function markValue( fieldId, color )
+	{
+	    document.getElementById(valueId).style.backgroundColor = color;	   
+	}
+    }
+</script>
+<style >
+	#tariffSetting {
+   width: 280px;
+   height: 50px;
+   margin: 10px 10px 10px 10px;
+   float:right;
+   padding: 10px 10px 10px 10px ;
+   font: 1.6em bold;
+   background: #ccc;
+   box-shadow: 2px 2px 2px rgba(0,0,0,0.5),
+   inset 8px 10px 10px rgba(255,255,255,0.75);   
+   -webkit-box-shadow: 2px 2px 2px rgba(0,0,0,0.5),
+   inset 8px 10px 10px rgba(255,255,255,0.75);
+   -moz-box-shadow: 2px 2px 2px rgba(0,0,0,0.5),
+   inset 8px 10px 10px rgba(255,255,255,0.75);
+   }
+</style>
+
+<h3>$i18n.getString( "payment_adjustment_screen" )</h3>
+
+<form id="paymentAdjustmentForm" name="paymentAdjustmentForm" method="post" >	
+<div>
+	<input type="hidden" id='selectedOrgunitID' name = 'selectedOrgunitID' value="$!organisationUnit.uid" />
+	<input type="hidden" id='selectedOrgunitName' name = 'selectedOrgunitName' value="$!organisationUnit.name" />
+	
+</div>
+
+<div class="inputCriteria" style="width:90%;height:auto;">
+<table>
+	<tr>
+		<td>
+			<table>
+					<tr>
+						<td><label for="orgUnitName">$i18n.getString( "organisation_unit" )</label></td>
+						<td><input type="text" id="orgUnitName" name = "orgUnitName" readonly="readonly" value="$!organisationUnit.name" style="width:352px"></td>
+					</tr>
+					
+					<tr>
+						<td><label>$i18n.getString( "dataset" )</label></td>
+						<td>
+							<select id="dataSetId" name = "dataSetId" style="width:354px" onchange="loadDataEntryForm()" #if( $dataSets.size() == 0 ) disabled="disabled" #end >
+								<option value="-1">$i18n.getString( "select_dataSet" )</option>
+								#foreach( $dataSet in $dataSets )
+									<option value="$dataSet.id">$dataSet.name</option>
+								#end
+							</select>
+						</td>		
+				    </tr>
+					<tr>
+						<td><label for="selectedPeriodId">$i18n.getString( "period" )</label></td>
+						<td><select id="selectedPeriodId" name="selectedPeriodId" style="width:200px" disabled="disabled" onchange="loadDataEntryForm()">
+								 <option value="-1">[$i18n.getString( "select" )]</option> 
+								#foreach( $period in $periods )
+									<option value="$period.iso">$encoder.htmlEncode( $period.name )</option>
+				    			#end
+							</select>
+							<input type="button" id="prevButton" disabled="disabled" style="width:75px" value="$i18n.getString( 'prev_year' )" title="$i18n.getString('earlier_periods')" onclick="getAvailablePeriodsTemp( 'selectedPeriodId', 'selectedPeriodId', '-1' )" >
+							<input type="button" id="nextButton" disabled="disabled" style="width:75px" value="$i18n.getString( 'next_year' )" title="$i18n.getString('later_periods')" onclick="getAvailablePeriodsTemp( 'selectedPeriodId', 'selectedPeriodId', '1' )" >
+							
+						</td>
+					</tr>
+				</table>
+		</td>
+		<td>
+			<table>
+				<tr>
+					<td>$i18n.getString( "amount_avaliable" )</td>
+					<td><input type="text" id="amountAvail" name="amountAvail" onblur="saveDataValue() "/></td>
+				</tr>
+				<tr>
+					<td>$i18n.getString( "adjustment_per" )</td>
+					<td><input type="text" id="adjustment" name="adjustment"/></td>
+				</tr>
+				<tr>
+					<td>&nbsp;</td>
+					<td>&nbsp;</td>
+				</tr>
+			</table>
+		</td>
+	</tr>
+</table>
+
+</div>
+
+
+#parse( "/dhis-web-commons/loader/loader.vm" )
+<div id='paymentDiv'></div> <!-- Payment Form -->  	
+
+</form>
+
+<script type="text/javascript">
+
+var i18n_select_dataset = '$encoder.jsEscape( $i18n.getString( "select_dataSet" ) , "'")';
+
+
+jQuery( document ).ready( function()
+{
+});
+</script>
\ No newline at end of file

=== added file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/paymentAdjustment.js'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/paymentAdjustment.js	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/paymentAdjustment.js	2014-03-28 18:52:45 +0000
@@ -0,0 +1,305 @@
+
+	var COLOR_GREEN = '#b9ffb9';
+	var COLOR_YELLOW = '#fffe8c';
+	var COLOR_RED = '#ff8a8a';
+	var COLOR_ORANGE = '#ff6600';
+	var COLOR_WHITE = '#ffffff';
+	var COLOR_GREY = '#cccccc';
+	var LocaleColor = 'black';
+	
+function orgUnitHasBeenSelected( orgUnitIds )
+{    
+	$( '#paymentDiv' ).html( '' );
+	
+	if( orgUnitIds != null && orgUnitIds != "" )
+	{
+		var dataSetId = $( '#dataSetId' ).val();
+		var periodId = $( '#selectedPeriodId' ).val();
+		 $.getJSON( 'getOrganisationUnitForPayment.action', {orgUnitId:orgUnitIds[0]}
+	        , function( json ) 
+	        {
+	            var type = json.response;
+	            alert(type);
+	            setFieldValue('orgUnitName', json.message );
+	            setFieldValue('selectedOrgunitName', json.message );	            
+	            if( type == "success" )
+	            {
+					enable('dataSetId');
+					
+					var options = '';
+		            $.each(json.dataSets, function(i, obj){
+		                options += '<option value="' + obj.id + '"'+ '>' + obj.name + '</option>';
+		            });
+		            $("select#dataSetId").html(options);
+		            
+		            $("select#dataSetId option[value="+dataSetId+"]").attr('selected', 'selected');
+		            $("select#selectedPeriodId option[value="+periodId+"]").attr('selected', 'selected');
+		            loadPeriods();		            
+					setFieldValue('selectedOrgunitID',orgUnitIds[0])
+	                setFieldValue('orgUnitName', json.message );
+	                setFieldValue('selectedOrgunitName', json.message );	                
+	            }
+	            else if( type == "input" )
+	            {
+	                disable('dataSetId');
+	                disable('selectedPeriodId');
+	                disable('prevButton');
+	                disable('nextButton');
+	                
+	                setFieldValue('orgUnitName', json.message );
+	                setFieldValue('selectedOrgunitName', json.message );
+	            }
+	        } );		
+	}
+}
+
+selection.setListenerFunction( orgUnitHasBeenSelected );
+
+
+function loadDataEntryForm()
+{
+	var orgUnitId = $( '#selectedOrgunitID' ).val();
+	var dataSetId = $( '#dataSetId' ).val();
+	$( '#paymentDiv' ).html('');
+	
+	$( '#saveButton' ).removeAttr( 'disabled' );
+	
+
+	var selectedPeriodId = $( '#selectedPeriodId' ).val();
+	
+	if ( selectedPeriodId == "-1" && dataSetId == "-1" )
+	{
+		$( '#paymentDiv' ).html('');
+		//document.getElementById( "saveButton" ).disabled = true;
+		return false;
+	}
+	
+	else
+	{
+	    jQuery('#loaderDiv').show();
+	    
+		jQuery('#paymentDiv').load('loadPaymentAdjustmentList.action',
+			{
+				orgUnitId:orgUnitId,
+				dataSetId:dataSetId,
+				periodIso:selectedPeriodId
+			}, function()
+			{
+				showById('paymentDiv');
+				jQuery('#loaderDiv').hide();
+			});
+		hideLoader();
+	}
+
+}
+
+function saveValue(dataElementId)
+{
+	var period = document.getElementById("selectedPeriodId").value;
+	var valueId = "score_"+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: 'saveDataValue.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_GREEN );
+	}
+
+	function markValue( fieldId, color )
+	{
+	    document.getElementById(valueId).style.backgroundColor = color;	   
+	}
+}
+
+
+function savePBFDataValue( dataElementId, valueType )
+{
+	var period = document.getElementById("selectedPeriodId").value;
+	var dataSetId = $( '#dataSetId' ).val();
+	var valueId = "";
+	if( valueType == 1 )
+	{
+		valueId = "pbfdv_qty_reported_"+dataElementId;
+	}
+	else
+	{
+		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,
+				'valueType' : valueType,
+				'dataSetId' : dataSetId,
+				'organisationUnitId' : $("#selectedOrgunitID").val(),
+				'periodIso' : period,
+				'value' : value
+    };
+    jQuery.ajax( {
+            url: 'saveValue.action',
+            data: dataValue,
+            dataType: 'json',
+            success: handleSuccess,
+            error: handleError
+        } );
+	}
+	
+	function handleSuccess( json )
+	{
+	    var code = json.c;
+
+	    alert(code)
+	    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_GREEN );
+	}
+
+	function markValue( fieldId, color )
+	{
+	    document.getElementById(valueId).style.backgroundColor = color;	   
+	}
+}
+
+// load periods
+function loadPeriods()
+{
+	$( '#paymentDiv' ).html( '' );
+	
+    var orgUnitId = $( '#selectedOrgunitID' ).val();
+
+    var dataSetId = $( '#dataSetId' ).val();
+	
+	
+	if ( dataSetId == "-1" )
+	{
+		showWarningMessage( i18n_select_dataset );
+		
+		document.getElementById( "selectedPeriodId" ).disabled = true;
+		document.getElementById( "prevButton" ).disabled = true;
+		document.getElementById( "nextButton" ).disabled = true;
+		return false;
+	}
+	
+	else
+	{
+		
+		enable('selectedPeriodId');
+		
+		enable('prevButton');
+		enable('nextButton');
+				
+		var url = 'loadPeriods.action?dataSetId=' + dataSetId;
+		
+		var list = document.getElementById( 'selectedPeriodId' );
+			
+		clearList( list );
+		
+		addOptionToList( list, '-1', '[ Select ]' );
+		
+	    $.getJSON( url, function( json ) {
+	    	for ( i in json.periods ) {
+	    		addOptionToList( list, json.periods[i].isoDate, json.periods[i].name );
+	    	}
+	    } );
+	    
+	}	
+}
+
+
+//next and pre periods
+function getAvailablePeriodsTemp( availablePeriodsId, selectedPeriodsId, year )
+{	
+	$( '#paymentDiv' ).html( '' );
+	
+	var dataSetId = $( '#dataSetId' ).val();
+	
+	var availableList = document.getElementById( availablePeriodsId );
+	var selectedList = document.getElementById( selectedPeriodsId );
+	
+	clearList( selectedList );
+	
+	addOptionToList( selectedList, '-1', '[ Select ]' );
+	
+	$.getJSON( "getAvailableNextPrePeriods.action", {
+		"dataSetId": dataSetId ,
+		"year": year },
+		function( json ) {
+			
+			for ( i in json.periods ) {
+	    		addOptionToList( selectedList, json.periods[i].isoDate, json.periods[i].name );
+	    	}
+			
+		} );
+}
+
+
+
+
+
+
+
+
+
+
+
+
+

=== added file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadPaymentAdjustment.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadPaymentAdjustment.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadPaymentAdjustment.vm	2014-03-28 18:52:45 +0000
@@ -0,0 +1,120 @@
+
+<script type="text/javascript" >
+
+	Ext.Loader.setConfig({
+		enabled: true
+	});
+	Ext.Loader.setPath('Ext.ux.grid', 'javascript');
+	Ext.require([
+		'Ext.data.*',
+		'Ext.grid.*',
+		'Ext.toolbar.Paging',
+		'Ext.ux.grid.TransformGrid'
+	]);
+	
+</script>
+
+<script >
+$(function() {
+			Ext.QuickTips.init();
+			
+			var grid = Ext.create('Ext.ux.grid.TransformGrid', "paymentDetails", {				
+			sortableColumns: true,
+            enableColumnMove: true,
+            enableColumnResize: true,
+            sortOnLoad: true,
+			width: tableWidth,
+        	height: 360,			
+            sorters: {direction: 'ASC'},
+			autoCreateViewPort:false,
+			renderTo: Ext.Element.get('#paymentTable'),
+        	layout: {
+            	type: 'hbox',
+            	align: 'stretch'
+        	},
+			columns: [
+    		{
+                text     : '$i18n.getString( "indicator" )',
+    			width    : columnWidth,            
+                sortable : true
+            },
+			{
+                text     : '$i18n.getString( "quantity_for" )',
+    			width    : columnWidth,            
+                sortable : true
+            },
+			{
+                text     : '$i18n.getString( "payment" )',
+    			width    : columnWidth,						
+                sortable : true
+            },
+			{
+                text     : '$i18n.getString( "amount" )',
+    			width    : columnWidth,						
+                sortable : true
+            },
+			{
+                text     : '$i18n.getString( "amount_including_quality" )',
+    			width    : columnWidth,						
+                sortable : true
+            },
+			{
+                text     : '$i18n.getString( "adjusted_per" )',
+    			width    : columnWidth,						
+                sortable : true
+            },
+			{
+                text     : '$i18n.getString( "adjusted_per" )',
+    			width    : columnWidth,						
+                sortable : false
+            }
+			]
+			});
+			
+			grid.render();
+
+});
+</script>
+<style >
+	.mandatory
+	{
+		color:red;
+		font-size: 1.5em;
+	}
+</style>
+
+<input type="hidden" id="dataElementId" name="dataElementId" value="$!selecteddataElement.id"/>
+<div style="width:100%;" id="paymentTable">
+<table id="paymentDetails" name="paymentDetails" cellspacing="0">
+	<thead >
+		<tr >
+			<th >$i18n.getString( "indicator" )</th>
+			<th >$i18n.getString( "quantity_for" )</th>
+			<th >$i18n.getString( "payment" )</th>
+			<th >$i18n.getString( "amount" )</th>
+			<th >$i18n.getString( "amount_including_quality" )</th>
+			<th >$i18n.getString( "adjusted_per" )</th>
+			<th >$i18n.getString( "adjusted_per" )</th>
+        </tr>
+	</thead>
+	<tbody>
+		#set( $mark = false )
+		#foreach( $dataElement in $dataElements )
+			#if( $mark )
+                #set( $mark = false )
+			#else
+				#set( $mark = true )
+			#end
+            <tr >
+				<td>$!dataElement.name</td>
+				<td>$!quantityValidatedMap.get( $dataElement.uid )</td>
+				<td>$!tariffDataValueMap.get( $dataElement.uid )</td>
+				<td>$!quantityValidatedMap.get( $dataElement.uid ) * $!tariffDataValueMap.get( $dataElement.uid )</td>
+				<td>&nbsp; </td>
+				<td>&nbsp;</td>
+	            <td>&nbsp;</td>			
+        </tr>
+		#end
+    </tbody>
+</table>
+</div>
\ No newline at end of file

=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/menu.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/menu.vm	2014-03-03 06:33:06 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/menu.vm	2014-03-28 18:52:45 +0000
@@ -20,4 +20,8 @@
 <h2>$i18n.getString( "Lookup" )</h2>
 <ul>
 	<li><a href="getAllLookups.action">$i18n.getString( "Lookup" )</a></li>
+</ul>
+<h2>$i18n.getString( "payment_adjustment" )</h2>
+<ul>
+	<li><a href="getPaymentAdjustmentDetail.action">$i18n.getString( "payment_adjustment" )</a></li>
 </ul>
\ No newline at end of file

=== added file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/menuPayment.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/menuPayment.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/menuPayment.vm	2014-03-28 18:52:45 +0000
@@ -0,0 +1,9 @@
+
+<a href="index.action"><h2>Payment Adjustment &nbsp;</h2></a>
+<ul>
+    <!--<li></li>-->
+    <!--<li></li>-->
+</ul>
+<br>
+
+#parse( "/dhis-web-commons/ouwt/orgunittreesearch.vm" )
\ No newline at end of file