[APRM] Update Payment Plan (RE): take amounts from payment schedule detail
authorMikel Irurita <mikel.irurita@openbravo.com>
Tue, 10 May 2011 10:10:47 +0200
changeset 12075 b4a9106936d9
parent 12074 af85d0df177c
child 12076 b9ee34858734
[APRM] Update Payment Plan (RE): take amounts from payment schedule detail
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java	Tue May 10 10:08:35 2011 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java	Tue May 10 10:10:47 2011 +0200
@@ -359,11 +359,12 @@
             removedPDS = new ArrayList<FIN_PaymentScheduleDetail>();
             for (FIN_PaymentScheduleDetail paymentScheduleDetail : paymentDetail
                 .getFINPaymentScheduleDetailList()) {
-              BigDecimal amount = paymentDetail.getAmount().add(paymentDetail.getWriteoffAmount());
+              BigDecimal amount = paymentScheduleDetail.getAmount().add(
+                  paymentScheduleDetail.getWriteoffAmount());
               if (paymentScheduleDetail.getInvoicePaymentSchedule() != null && restorePaidAmounts) {
                 FIN_AddPayment.updatePaymentScheduleAmounts(paymentScheduleDetail
-                    .getInvoicePaymentSchedule(), paymentDetail.getAmount().negate(), paymentDetail
-                    .getWriteoffAmount().negate());
+                    .getInvoicePaymentSchedule(), paymentScheduleDetail.getAmount().negate(),
+                    paymentScheduleDetail.getWriteoffAmount().negate());
                 // BP SO_CreditUsed
                 businessPartner = paymentScheduleDetail.getInvoicePaymentSchedule().getInvoice()
                     .getBusinessPartner();
@@ -375,8 +376,8 @@
               }
               if (paymentScheduleDetail.getOrderPaymentSchedule() != null && restorePaidAmounts) {
                 FIN_AddPayment.updatePaymentScheduleAmounts(paymentScheduleDetail
-                    .getOrderPaymentSchedule(), paymentDetail.getAmount().negate(), paymentDetail
-                    .getWriteoffAmount().negate());
+                    .getOrderPaymentSchedule(), paymentScheduleDetail.getAmount().negate(),
+                    paymentScheduleDetail.getWriteoffAmount().negate());
               }
               // when generating credit for a BP SO_CreditUsed is also updated
               if (paymentScheduleDetail.getInvoicePaymentSchedule() == null