details:   https://code.openbravo.com/erp/devel/pi/rev/650c384edc2a
changeset: 17797:650c384edc2a
user:      Javier Etxarri <javier.echarri <at> openbravo.com>
date:      Wed Aug 29 11:53:16 2012 +0200
summary:   Fixes issue 21458: The column Consum per unit Std of the production 
cost report should show other value

diffstat:

 src/org/openbravo/erpCommon/ad_reports/ReportProductionCost_data.xsql |  8 
+++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r fd5f0599fa55 -r 650c384edc2a 
src/org/openbravo/erpCommon/ad_reports/ReportProductionCost_data.xsql
--- a/src/org/openbravo/erpCommon/ad_reports/ReportProductionCost_data.xsql     
Wed Aug 29 10:45:56 2012 +0200
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportProductionCost_data.xsql     
Wed Aug 29 11:53:16 2012 +0200
@@ -75,20 +75,22 @@
        SELECT auxSeq.M_Product_ID AS ID, M_Product.Name, 
         SUM(auxSeq.ComponentCost*auxSeq.ConsumedQty)/SUM(auxSeq.ProducedQty) 
AS ConsumedPerUnit, 
         SUM(auxSeq.TotalRealCost)/SUM(auxSeq.ConsumedQty) AS CostPerUnit,
-        SUM(auxSeq.ComponentCost*sp.Quantity)/SUM(sp.Quantity) AS 
ConsumedPerUnitStd, 
+        SUM(auxSeq.ComponentCost*sp.Quantity)/SUM(auxSeq.ProducedStdQuantity) 
* SUM(Coalesce(sp.decrease,1)) * SUM(coalesce(sp.rejected,1)) AS 
ConsumedPerUnitStd, 
         MAX(C_CURRENCY_CONVERT(sp.Cost, ?, ?, TO_DATE(sp.Updated), null, 
sp.ad_client_id, sp.ad_org_id)) AS CostPerUnitStd, 
             to_char(?)||to_char(auxSeq.M_Product_ID) as identifier, 
to_char((to_number(?)+1)*5) as level_blanck, to_char(40-((to_number(?)+1)*5)) 
as level_name, case when M_Product.MA_ProcessPlan_ID is null then '' else 
'datawarehouseclose' end as button_class, to_char(to_number(?)+1) as levelid
         FROM 
           (SELECT rpn.M_Product_ID, rpp.ComponentCost, SUM(rpn.ConsumedQty) AS 
ConsumedQty, 
-           SUM(rpp.ProducedQty) AS ProducedQty, 
SUM(rpn.ConsumedQty*rpn.CalcCost) AS TotalRealCost, rpp.MA_Sequence_ID
+           SUM(rpp.ProducedQty) AS ProducedQty, 
SUM(rpn.ConsumedQty*rpn.CalcCost) AS TotalRealCost, rpp.MA_Sequence_ID, 
rpp.ProducedStdQuantity
            FROM
               (SELECT SUM(pl.MovementQty) AS ProducedQty, 
               MAX(C_CURRENCY_CONVERT(pl.ComponentCost, ?, ?, 
TO_DATE(p.movementdate), null, pl.ad_client_id, pl.ad_org_id)) AS 
ComponentCost, 
-              pp.M_ProductionPlan_ID, wrp.MA_Sequence_ID
+              pp.M_ProductionPlan_ID, wrp.MA_Sequence_ID,sp.sum(sp.quantity) 
as ProducedStdQuantity
               FROM M_Production p
                 INNER JOIN M_ProductionPlan pp ON (p.M_Production_ID = 
pp.M_Production_ID)
                 INNER JOIN M_ProductionLine pl ON (pp.M_ProductionPlan_ID = 
pl.M_ProductionPlan_ID)
                 INNER JOIN MA_WRPhase wrp ON (pp.MA_WRPhase_ID = 
wrp.MA_WRPhase_ID)
+                LEFT OUTER JOIN MA_SequenceProduct sp 
+                ON (pl.M_Product_ID = sp.M_Product_ID AND wrp.MA_Sequence_ID = 
sp.MA_Sequence_ID)
               WHERE p.IsSOTrx = 'N'
               AND pl.ProductionType = '+'
               AND p.Processed = 'Y'

------------------------------------------------------------------------------
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