details:   https://code.openbravo.com/erp/devel/pi/rev/67204ba1503e
changeset: 31714:67204ba1503e
user:      Atul Gaware <atul.gaware <at> openbravo.com>
date:      Mon Mar 20 10:43:41 2017 +0530
summary:   Fixes issue 35369: Positive commission generated from fully paid 
Credit Memos

When calculating commission for invoices with multiline payment terms 
commission is
calculated based on expected payment amount in the particular month. Expected 
amount
sign is as per the type of document type so -1 multiplier in case of credit memo
is no required in case of fully paid document basis.

diffstat:

 src-db/database/model/functions/C_COMMISSION_PROCESS.xml |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 32f9d18198dc -r 67204ba1503e 
src-db/database/model/functions/C_COMMISSION_PROCESS.xml
--- a/src-db/database/model/functions/C_COMMISSION_PROCESS.xml  Tue Mar 21 
09:38:12 2017 +0100
+++ b/src-db/database/model/functions/C_COMMISSION_PROCESS.xml  Mon Mar 20 
10:43:41 2017 +0530
@@ -16,7 +16,7 @@
   * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, 
parts
   * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights 
Reserved.
   * Contributor(s): Openbravo SLU
-  * Contributions are Copyright (C) 2001-2015 Openbravo S.L.U.
+  * Contributions are Copyright (C) 2001-2017 Openbravo S.L.U.
   
******************************************************************************/
   -- Logistice
   v_ResultStr VARCHAR2(2000):='';
@@ -249,7 +249,7 @@
           IF(v_ListDetails='Y' OR v_IsCascade='Y') THEN
             IF(v_BasisAmt='N') THEN
               IF(v_BasisStatus='F') THEN
-                v_Cmd:='SELECT h.C_Currency_ID, CASE WHEN dt.docbasetype IN 
(''ARC'',''APC'') THEN -1 ELSE 1 END * l.LineNetAmt * (psv.expected / 
h.grandtotal),'
+                v_Cmd:='SELECT h.C_Currency_ID, l.LineNetAmt * (psv.expected / 
h.grandtotal),'
                 || 'CASE WHEN dt.docbasetype IN (''ARC'',''APC'') THEN -1 ELSE 
1 END * l.QtyInvoiced, '
                 || 'NULL, l.C_InvoiceLine_ID, h.DocumentNo, 
substr(COALESCE(prd.Name,l.Description),1,60), ''Y'' '
                 || 'FROM C_Invoice h JOIN C_InvoiceLine l ON h.C_Invoice_ID = 
l.C_Invoice_ID'
@@ -286,7 +286,7 @@
           ELSE
             --v_BasisAmt = 'N'
             IF(v_BasisStatus='F') THEN
-              v_Cmd:='SELECT h.C_Currency_ID, SUM(CASE WHEN dt.docbasetype IN 
(''ARC'',''APC'') THEN -1 ELSE 1 END * l.LineNetAmt * (psv.expected / 
h.grandtotal)) AS Amt,'
+              v_Cmd:='SELECT h.C_Currency_ID, SUM(l.LineNetAmt * (psv.expected 
/ h.grandtotal)) AS Amt,'
               || ' SUM(CASE WHEN dt.docbasetype IN (''ARC'',''APC'') THEN -1 
ELSE 1 END * l.QtyInvoiced) AS Qty, '
               || 'NULL, NULL, NULL, NULL, ''Y'' '
               || 'FROM C_Invoice h JOIN C_InvoiceLine l ON h.C_Invoice_ID = 
l.C_Invoice_ID'

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to