Fixed issue with payment monitor in invoices extension point procedure.
authorGorka Ion Damián <gorkaion.damian@openbravo.com>
Wed, 31 Mar 2010 16:29:56 +0200
changeset 6882 e740caf5b844
parent 6881 d179ed258b72
child 6883 ac47c1cf8454
Fixed issue with payment monitor in invoices extension point procedure.
src-db/database/model/functions/FIN_GEN_PAYMENTSCHEDULE_INV.xml
--- a/src-db/database/model/functions/FIN_GEN_PAYMENTSCHEDULE_INV.xml	Tue Mar 30 19:11:47 2010 +0200
+++ b/src-db/database/model/functions/FIN_GEN_PAYMENTSCHEDULE_INV.xml	Wed Mar 31 16:29:56 2010 +0200
@@ -326,22 +326,19 @@
       SELECT sum(PAIDAMT) as PaidAmount, SUM(OUTSTANDINGAMT) as OutstandingAmount
         INTO v_PaidAmount,V_OutstandingAmount
       FROM FIN_PAYMENT_SCHEDULE 
-      WHERE C_INVOICE_ID=P_RECORD_ID 
-      group by c_invoice_id;
+      WHERE C_INVOICE_ID=P_RECORD_ID;
       -- Getting DueAmount from FIN_PAYMENT_SCHEDULE for the Invoice
       SELECT sum(OUTSTANDINGAMT) as DueAmount
         INTO V_DueAmount
       FROM FIN_PAYMENT_SCHEDULE 
       WHERE C_INVOICE_ID=P_RECORD_ID
-        AND duedate<=now()
-      group by c_invoice_id;
+        AND duedate<=now();
       V_DueAmount :=COALESCE(V_DueAmount,0);
       --Getting Day Still Due
       SELECT COALESCE(TO_NUMBER(MIN(DUEDATE)-TRUNC(NOW())),0) as DAYSTILLDUE
       INTO V_DayStillDue
       FROM FIN_PAYMENT_SCHEDULE
       WHERE C_INVOICE_ID=P_RECORD_ID
-        AND DUEDATE <= now()
         AND OUTSTANDINGAMT != 0;
 
       --Updating Payment Monitor values into C_INVOICE