details:   https://code.openbravo.com/erp/devel/pi/rev/5f69cb68090f
changeset: 16606:5f69cb68090f
user:      Sandra Huguet <sandra.huguet <at> openbravo.com>
date:      Mon May 07 15:19:46 2012 +0200
summary:   Fixed bug 16507 Update 'collected' field in update Project 
Profitability
Update 'collected' field in update Project Profitability report to APR

details:   https://code.openbravo.com/erp/devel/pi/rev/650d3a0a5225
changeset: 16607:650d3a0a5225
user:      Sandra Huguet <sandra.huguet <at> openbravo.com>
date:      Mon May 07 09:15:35 2012 +0200
summary:   Fixed bug 9177 Change price list in sales order
Change price list in sales order when create a sales order
using create sales order from Expenses

diffstat:

 src/org/openbravo/erpCommon/ad_actionButton/ExpenseSOrder.java              |  
29 ++++-----
 src/org/openbravo/erpCommon/ad_reports/ReportProjectProfitability_data.xsql |  
 6 +-
 2 files changed, 16 insertions(+), 19 deletions(-)

diffs (73 lines):

diff -r 12897abf99f7 -r 650d3a0a5225 
src/org/openbravo/erpCommon/ad_actionButton/ExpenseSOrder.java
--- a/src/org/openbravo/erpCommon/ad_actionButton/ExpenseSOrder.java    Wed May 
23 18:06:42 2012 +0200
+++ b/src/org/openbravo/erpCommon/ad_actionButton/ExpenseSOrder.java    Mon May 
07 09:15:35 2012 +0200
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2001-2011 Openbravo SLU
+ * All portions are Copyright (C) 2001-2012 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -362,25 +362,22 @@
 
         BigDecimal priceActual, priceList, priceLimit, discount;
 
-        // If there is no invoice price, looks for the prices in the
-        // pricelist of the business partner
-        if (data.invoiceprice == null || data.invoiceprice.equals("")) {
-          ExpenseSOrderData[] data3 = ExpenseSOrderData.selectPrice(this, 
data.mProductId,
-              data.mPricelistId, strBPCCurrencyId);
-          for (int j = 0; data3 != null && j < data3.length; j++) {
-            if (data3[j].validfrom == null || data3[j].validfrom.equals("")
-                || !DateTimeData.compare(this, strDateexpense, 
data3[j].validfrom).equals("-1")) {
-              priceactual = data3[j].pricestd;
-              pricelist = data3[j].pricelist;
-              pricelimit = data3[j].pricelimit;
-            }
+        // Looks for the prices in the pricelist of the business partner
+        ExpenseSOrderData[] data3 = ExpenseSOrderData.selectPrice(this, 
data.mProductId,
+            data.mPricelistId, strBPCCurrencyId);
+        for (int j = 0; data3 != null && j < data3.length; j++) {
+          if (data3[j].validfrom == null || data3[j].validfrom.equals("")
+              || !DateTimeData.compare(this, strDateexpense, 
data3[j].validfrom).equals("-1")) {
+            priceactual = data3[j].pricestd;
+            pricelist = data3[j].pricelist;
+            pricelimit = data3[j].pricelimit;
           }
-        } else {
+        }
+
+        if (data.invoiceprice != null && !"".equals(data.invoiceprice)) {
           // If there is an invoice price, it takes it and makes
           // currency conversions, if necessary
           priceactual = data.invoiceprice;
-          pricelist = "0";
-          pricelimit = "0";
 
           // If the currency of the expense line is not the same as
           // the currency of the business partner pricelist, make the
diff -r 12897abf99f7 -r 650d3a0a5225 
src/org/openbravo/erpCommon/ad_reports/ReportProjectProfitability_data.xsql
--- 
a/src/org/openbravo/erpCommon/ad_reports/ReportProjectProfitability_data.xsql   
    Wed May 23 18:06:42 2012 +0200
+++ 
b/src/org/openbravo/erpCommon/ad_reports/ReportProjectProfitability_data.xsql   
    Mon May 07 09:15:35 2012 +0200
@@ -12,7 +12,7 @@
     * under the License. 
     * The Original Code is Openbravo ERP. 
     * The Initial Developer of the Original Code is Openbravo SLU 
-    * All portions are Copyright (C) 2001-2008 Openbravo SLU 
+    * All portions are Copyright (C) 2001-2012 Openbravo SLU 
     * All Rights Reserved. 
     * Contributor(s):  ______________________________________.
     ************************************************************************
@@ -177,8 +177,8 @@
            FROM (
            SELECT CASE WHEN ila.C_InvoiceLine_AcctDimension_ID IS NULL THEN 
id.c_project_id ELSE ila.c_project_id END AS C_Project,
                   CASE WHEN ila.C_InvoiceLine_AcctDimension_ID IS NULL 
-                  THEN C_CURRENCY_CONVERT(il.linenetamt, id.C_CURRENCY_ID, ?, 
TO_DATE(COALESCE(id.DATEINVOICED, NOW())), NULL, il.AD_CLIENT_ID, 
il.AD_ORG_ID)*C_Invoice_Percentage_Paid(id.C_Invoice_ID) 
-                  ELSE C_CURRENCY_CONVERT(ila.amt, id.C_CURRENCY_ID, ?, 
TO_DATE(COALESCE(id.DATEINVOICED, NOW())), NULL, ila.AD_CLIENT_ID, 
ila.AD_ORG_ID)*C_Invoice_Percentage_Paid(id.C_Invoice_ID) END AS amount
+                  THEN C_CURRENCY_CONVERT(il.linenetamt, id.C_CURRENCY_ID, ?, 
TO_DATE(COALESCE(id.DATEINVOICED, NOW())), NULL, il.AD_CLIENT_ID, il.AD_ORG_ID) 
* (CASE WHEN id.grandtotal=0 THEN 0 ELSE (id.totalpaid/id.grandtotal) END) 
+                  ELSE C_CURRENCY_CONVERT(ila.amt, id.C_CURRENCY_ID, ?, 
TO_DATE(COALESCE(id.DATEINVOICED, NOW())), NULL, ila.AD_CLIENT_ID, 
ila.AD_ORG_ID) * (CASE WHEN id.grandtotal=0 THEN 0 ELSE 
(id.totalpaid/id.grandtotal) END) END AS amount
            FROM C_Invoice id, C_InvoiceLine il LEFT JOIN 
C_InvoiceLine_AcctDimension ila on il.C_InvoiceLine_ID = ila.C_InvoiceLine_ID,
              M_Product p
            WHERE id.C_Invoice_ID = il.C_Invoice_ID

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to