details:   /erp/stable/2.50/rev/944b0da4c10e
changeset: 9332:944b0da4c10e
user:      Egoitz Castillo <egoitz.castillo <at> openbravo.com>
date:      Fri Apr 01 18:05:39 2011 +0200
summary:   Fixes issue 0015888: Wrong "adjusted price" when using price 
adjustments
Now the difference is calculated based on the price standard.

diffstat:

 src-db/database/model/triggers/C_ORDERLINE_TRG2.xml       |  11 ++++++-----
 src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java |   2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diffs (54 lines):

diff -r 719288469b1c -r 944b0da4c10e 
src-db/database/model/triggers/C_ORDERLINE_TRG2.xml
--- a/src-db/database/model/triggers/C_ORDERLINE_TRG2.xml       Tue Mar 22 
11:50:02 2011 +0100
+++ b/src-db/database/model/triggers/C_ORDERLINE_TRG2.xml       Fri Apr 01 
18:05:39 2011 +0200
@@ -80,8 +80,9 @@
       AND o.C_Currency_ID = c.C_Currency_ID;
 
   --Get the new "std" price from the Actual price (if actual price is the std 
price they will be equal)
-   v_Price := :NEW.PriceActual;
-    FOR Cur_Offer IN (SELECT M_OFFER_ID
+   --v_Price := :NEW.PriceActual;
+   v_Price := :NEW.PRICESTD;
+   /* FOR Cur_Offer IN (SELECT M_OFFER_ID
          FROM M_OFFER
          WHERE :NEW.DateOrdered BETWEEN DATEFROM AND 
COALESCE(DATETO,TO_DATE('31-12-9999','DD-MM-YYYY'))
    AND IsActive = 'Y'
@@ -123,7 +124,7 @@
            AND OP.M_PRODUCT_CATEGORY_ID = P.M_PRODUCT_CATEGORY_ID)))
          ORDER BY PRIORITY DESC, M_OFFER_ID) LOOP
     v_Price := M_Get_Offer_Std_Price(Cur_Offer.M_Offer_ID, v_Price);
-   END LOOP;
+   END LOOP;*/
 
 
 --   :new.PriceStd := v_Price;
@@ -173,7 +174,7 @@
    Ad_Sequence_Next('C_OrderLine_Offer', :NEW.AD_Client_ID, 
v_OrderLine_Offer_ID);
    v_lineno := v_lineno + 10;
    v_PriceNew := M_Get_Offer_Price(Cur_Offer.M_Offer_ID, v_Price);
-   v_Amt := v_Price - v_PriceNew;
+   v_Amt := v_Price - coalesce(round(v_PriceNew, v_Precision), 0);
 
    IF (:NEW.CANCELPRICEAD='N')
     THEN
@@ -185,7 +186,7 @@
          (v_OrderLine_Offer_ID, :NEW.AD_Client_ID, :NEW.AD_Org_ID, 
:NEW.IsActive,
         now(),:NEW.CreatedBy, now(),:NEW.UpdatedBy,
        :NEW.C_OrderLine_ID, v_lineno, Cur_Offer.M_Offer_Id, 
COALESCE(ROUND(v_Price,v_Precision),0), COALESCE(ROUND(v_Amt,v_Precision),0));
-      v_Price := v_PriceNew;
+      --v_Price := v_PriceNew;
    END IF;
   END LOOP;
  END IF;
diff -r 719288469b1c -r 944b0da4c10e 
src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java Tue Mar 22 
11:50:02 2011 +0100
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java Fri Apr 01 
18:05:39 2011 +0200
@@ -162,7 +162,7 @@
         // Do not do anything.
         if (!priceActual.equals(expectedPriceActual)) {
           priceStd = new BigDecimal(SLOrderProductData.getOffersStdPrice(this,
-              dataOrder[0].cBpartnerId, priceActual.toString().replace("\"", 
""), strProduct,
+              dataOrder[0].cBpartnerId, 
expectedPriceActual.toString().replace("\"", ""), strProduct,
               dataOrder[0].dateordered, strQty, dataOrder[0].mPricelistId, 
dataOrder[0].id));
         }
         // priceList

------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to