dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #29240
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14738: WorkInProgress: PBF Payment Adjustment
------------------------------------------------------------
revno: 14738
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-04-08 13:05:57 +0100
message:
WorkInProgress: PBF Payment Adjustment
modified:
dhis-2/dhis-web/dhis-web-portal/india-pom.xml
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/LoadPaymentAdjustmentAction.java
local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadPaymentAdjustment.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-web/dhis-web-portal/india-pom.xml'
--- dhis-2/dhis-web/dhis-web-portal/india-pom.xml 2014-02-10 10:37:03 +0000
+++ dhis-2/dhis-web/dhis-web-portal/india-pom.xml 2014-04-08 12:05:57 +0000
@@ -176,17 +176,12 @@
<version>${project.version}</version>
<type>war</type>
</dependency>
- <dependency>
- <groupId>org.hisp.dhis</groupId>
- <artifactId>dhis-web-appmanager</artifactId>
- <version>${project.version}</version>
- <type>war</type>
- </dependency>
+
<!-- India modules -->
<dependency>
<groupId>org.hisp.dhis</groupId>
- <artifactId>dhis-web-maintenance-coldchain</artifactId>
+ <artifactId>dhis-web-maintenance-ccem</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/LoadPaymentAdjustmentAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/LoadPaymentAdjustmentAction.java 2014-04-07 12:32:43 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/payment/action/LoadPaymentAdjustmentAction.java 2014-04-08 12:05:57 +0000
@@ -7,6 +7,7 @@
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -25,6 +26,7 @@
import org.hisp.dhis.pbf.api.PBFDataValueService;
import org.hisp.dhis.pbf.api.QualityMaxValueService;
import org.hisp.dhis.pbf.api.TariffDataValueService;
+import org.hisp.dhis.pbf.impl.DefaultPBFAggregationService;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.period.PeriodType;
@@ -70,6 +72,9 @@
@Autowired
private QualityMaxValueService qualityMaxValueService;
+
+ @Autowired
+ private DefaultPBFAggregationService defaultPBFAggregationService;
// -------------------------------------------------------------------------
// Input / Output
@@ -88,7 +93,21 @@
return pbfTariffMap;
}
- private String orgUnitId;
+ private Double overAllQualityScore = 0.0;
+
+ public Double getOverAllQualityScore()
+ {
+ return overAllQualityScore;
+ }
+
+ Set<DataElement> dataElements = new HashSet<DataElement>();
+
+ public Set<DataElement> getDataElements()
+ {
+ return dataElements;
+ }
+
+ private String orgUnitId;
public void setOrgUnitId( String orgUnitId )
{
@@ -116,6 +135,12 @@
public String execute()
throws Exception
{
+
+ System.out.println("Inside Adjustment screen");
+
+ if( periodIso.equals("-1") )
+ return SUCCESS;
+
OrganisationUnit selOrgUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
DataSet selDataSet = dataSetService.getDataSet( Integer.parseInt( dataSetId ) );
@@ -128,7 +153,7 @@
Collection<Integer> periodIds = new ArrayList<Integer>( getIdentifiers( Period.class, periods ) );
String periodIdsByComma = getCommaDelimitedString( periodIds );
- Set<DataElement> dataElements = new HashSet<DataElement>( selDataSet.getDataElements() );
+ dataElements.addAll( selDataSet.getDataElements() );
Set<OrganisationUnit> pbfQtyOrgUnits = new HashSet<OrganisationUnit>();
pbfQtyOrgUnits.addAll( organisationUnitService.getOrganisationUnitWithChildren( selOrgUnit.getId() ) );
@@ -163,6 +188,24 @@
// QualityScore
//-----------------------------------------------------------
+ List<Lookup> lookups = new ArrayList<Lookup>( lookupService.getAllLookupsByType( Lookup.DS_PAYMENT_TYPE ) );
+ DataSet qualityScoreDataSet = null;
+ for ( Lookup lookup : lookups )
+ {
+ String[] lookupType = lookup.getValue().split( ":" );
+ if ( Integer.parseInt( lookupType[0] ) == Integer.parseInt( dataSetId ) )
+ {
+ qualityScoreDataSet = dataSetService.getDataSet( lookupType[1] );
+ break;
+ }
+ }
+
+ if( qualityScoreDataSet != null )
+ {
+ overAllQualityScore = defaultPBFAggregationService.calculateOverallQualityScore( period, qualityScoreDataSet.getSources(), qualityScoreDataSet.getId(), tariffOrgUnit.getId() );
+ }
+
+
return SUCCESS;
}
=== 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-04-05 12:21:33 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml 2014-04-08 12:05:57 +0000
@@ -197,7 +197,7 @@
</action>
<!-- Load Payment Adjustment List -->
- <action name="loadPaymentAdjustmentList" class="org.hisp.dhis.pbf.payment.action.LoadPaymentAdjustmentDetailsAction">
+ <action name="loadPaymentAdjustmentList" class="org.hisp.dhis.pbf.payment.action.LoadPaymentAdjustmentAction">
<result name="success" type="velocity">/content.vm</result>
<param name="page">/dhis-web-maintenance-pbf/loadPaymentAdjustment.vm</param>
</action>
=== modified 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 2014-04-02 16:32:50 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadPaymentAdjustment.vm 2014-04-08 12:05:57 +0000
@@ -45,10 +45,11 @@
<tr #if( $mark ) bgcolor = "#FFFFFF" #else bgcolor="#E0ECF8" #end>
<td>$!dataElement.name</td>
- <td>$!quantityValidatedMap.get( $dataElement.uid )</td>
- <td>$!tariffDataValueMap.get( $dataElement.uid )</td>
- <td>$!amountMap.get( $dataElement.uid )</td>
- <td> </td>
+ <td>$!pbfQtyMap.get( $dataElement.id )</td>
+ <td>$!pbfTariffMap.get( $dataElement.id )</td>
+ #set( $tariffVal = $!pbfQtyMap.get( $dataElement.id ) * $!pbfTariffMap.get( $dataElement.id ) )
+ <td>$tariffVal</td>
+ <td>$!overAllQualityScore</td>
<td id="adjusted_$dataElement.uid"> </td>
<td> </td>
</tr>
@@ -56,7 +57,7 @@
function calValue()
{
var adjusted = $("#adjustment").val();
- var amount = '$!tariffDataValueMap.get( $dataElement.uid )';
+ var amount = '$!pbfTariffMap.get( $dataElement.id )';
var adjustedPer = 0.0;
adjustedPer = (parseFloat(amount)/parseFloat(adjusted))*100
$('#adjusted_$dataElement.uid').text(adjustedPer.toFixed(2));