Fix view definition in ddlutils according to fixed migration scripts

This commit is contained in:
Carlos Ruiz 2008-05-28 06:43:36 +00:00
parent e30a0b39d3
commit 2b8983ab59
6 changed files with 113 additions and 53 deletions

View File

@ -49,9 +49,11 @@ SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.
'en_US' AS AD_Language,
il.C_Invoice_ID, il.C_InvoiceLine_ID,
il.C_Tax_ID, il.TaxAmt, il.LineTotalAmt, t.TaxIndicator,
il.Line+(b.Line/100) AS Line, p.M_Product_ID,
il.QtyInvoiced*b.BOMQty AS QtyInvoiced,
il.QtyEntered*b.BOMQty AS QtyEntered,
il.Line+(bl.Line/100) AS Line, p.M_Product_ID,
--il.QtyInvoiced*b.BOMQty AS QtyInvoiced,
CASE WHEN bl.IsQtyPercentage = 'N' THEN il.QtyInvoiced*bl.QtyBOM ELSE il.QtyInvoiced*(bl.QtyBatch / 100) END AS QtyInvoiced,
--il.QtyEntered*b.BOMQty AS QtyEntered,
CASE WHEN bl.IsQtyPercentage = 'N' THEN il.QtyEntered*bl.QtyBOM ELSE il.QtyEntered*(bl.QtyBatch / 100) END AS QtyEntered,
uom.UOMSymbol,
p.Name, -- main
b.Description,
@ -60,13 +62,22 @@ SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.
il.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate,
p.Description as ProductDescription, p.ImageURL,
il.C_Campaign_ID, il.C_Project_ID, il.C_Activity_ID, il.C_ProjectPhase_ID, il.C_ProjectTask_ID
FROM M_Product_BOM b -- BOM lines
/*FROM M_Product_BOM b -- BOM lines
INNER JOIN C_InvoiceLine il ON (b.M_Product_ID=il.M_Product_ID)
INNER JOIN M_Product bp ON (bp.M_Product_ID=il.M_Product_ID -- BOM Product
AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y')
INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) -- BOM line product
INNER JOIN C_UOM uom ON (p.C_UOM_ID=uom.C_UOM_ID)
LEFT OUTER JOIN C_Tax t ON (il.C_Tax_ID=t.C_Tax_ID)
LEFT OUTER JOIN M_AttributeSetInstance asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)*/
FROM PP_Product_BOM b -- BOM lines
INNER JOIN C_InvoiceLine il ON (b.M_Product_ID=il.M_Product_ID)
INNER JOIN M_Product bp ON (bp.M_Product_ID=il.M_Product_ID -- BOM Product
AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y')
INNER JOIN PP_Product_BOMLine bl ON (bl.PP_Product_BOM_ID=b.PP_Product_BOM_ID)
INNER JOIN M_Product p ON (bl.M_Product_ID=p.M_Product_ID) -- BOM line product
INNER JOIN C_UOM uom ON (p.C_UOM_ID=uom.C_UOM_ID)
LEFT OUTER JOIN C_Tax t ON (il.C_Tax_ID=t.C_Tax_ID)
LEFT OUTER JOIN M_AttributeSetInstance asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
UNION -- comment lines
SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy,
@ -109,6 +120,3 @@ SELECT it.AD_Client_ID, it.AD_Org_ID, it.IsActive, it.Created, it.CreatedBy, it.
null, null, null, null, null
FROM C_InvoiceTax it
INNER JOIN C_Tax t ON (it.C_Tax_ID=t.C_Tax_ID);

View File

@ -49,9 +49,11 @@ SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.
uom.AD_Language,
il.C_Invoice_ID, il.C_InvoiceLine_ID,
il.C_Tax_ID, il.TaxAmt, il.LineTotalAmt, t.TaxIndicator,
il.Line+(b.Line/100) AS Line, p.M_Product_ID,
il.QtyInvoiced*b.BOMQty AS QtyInvoiced,
il.QtyEntered*b.BOMQty AS QtyEntered,
il.Line+(bl.Line/100) AS Line, p.M_Product_ID,
--il.QtyInvoiced*b.BOMQty AS QtyInvoiced,
CASE WHEN bl.IsQtyPercentage = 'N' THEN il.QtyInvoiced*bl.QtyBOM ELSE il.QtyInvoiced*(bl.QtyBatch / 100) END AS QtyInvoiced,
--il.QtyEntered*b.BOMQty AS QtyEntered,
CASE WHEN bl.IsQtyPercentage = 'N' THEN il.QtyEntered*bl.QtyBOM ELSE il.QtyEntered*(bl.QtyBatch / 100) END AS QtyEntered,
uom.UOMSymbol,
COALESCE(pt.Name,p.Name) AS Name, -- main
b.Description,
@ -60,7 +62,7 @@ SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.
il.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate,
pt.Description as ProductDescription, p.ImageURL,
il.C_Campaign_ID, il.C_Project_ID, il.C_Activity_ID, il.C_ProjectPhase_ID, il.C_ProjectTask_ID
FROM M_Product_BOM b -- BOM lines
/*FROM M_Product_BOM b -- BOM lines
INNER JOIN C_InvoiceLine il ON (b.M_Product_ID=il.M_Product_ID)
INNER JOIN M_Product bp ON (bp.M_Product_ID=il.M_Product_ID -- BOM Product
AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y')
@ -68,6 +70,16 @@ FROM M_Product_BOM b -- BOM lines
INNER JOIN C_UOM_Trl uom ON (p.C_UOM_ID=uom.C_UOM_ID)
INNER JOIN M_Product_Trl pt ON (b.M_ProductBOM_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language)
LEFT OUTER JOIN C_Tax t ON (il.C_Tax_ID=t.C_Tax_ID)
LEFT OUTER JOIN M_AttributeSetInstance asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)*/
FROM PP_Product_BOM b -- BOM lines
INNER JOIN C_InvoiceLine il ON (b.M_Product_ID=il.M_Product_ID)
INNER JOIN M_Product bp ON (bp.M_Product_ID=il.M_Product_ID -- BOM Product
AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y')
INNER JOIN PP_Product_BOMLine bl ON (bl.PP_Product_BOM_ID=b.PP_Product_BOM_ID)
INNER JOIN M_Product p ON (bl.M_Product_ID=p.M_Product_ID) -- BOM line product
INNER JOIN C_UOM_Trl uom ON (p.C_UOM_ID=uom.C_UOM_ID)
INNER JOIN M_Product_Trl pt ON (bl.M_Product_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language)
LEFT OUTER JOIN C_Tax t ON (il.C_Tax_ID=t.C_Tax_ID)
LEFT OUTER JOIN M_AttributeSetInstance asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
UNION -- comment line
SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy,
@ -112,6 +124,3 @@ SELECT it.AD_Client_ID, it.AD_Org_ID, it.IsActive, it.Created, it.CreatedBy, it.
null,null,null,null,null
FROM C_InvoiceTax it
INNER JOIN C_Tax_Trl t ON (it.C_Tax_ID=t.C_Tax_ID);

View File

@ -2,7 +2,7 @@ CREATE OR REPLACE VIEW C_ORDER_LINETAX_V
(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
UPDATED, UPDATEDBY, AD_LANGUAGE, C_ORDER_ID, C_ORDERLINE_ID,
C_TAX_ID, TAXINDICATOR, C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, BPNAME,
C_LOCATION_ID, LINE, M_PRODUCT_ID, QTYORDERED, QTYENTERED,
C_LOCATION_ID, LINE, M_PRODUCT_ID,VendorProductNo, QTYORDERED, QTYENTERED,
UOMSYMBOL, NAME, DESCRIPTION, DOCUMENTNOTE, UPC,
SKU, PRODUCTVALUE, RESOURCEDESCRIPTION, PRICELIST, PRICEENTEREDLIST,
DISCOUNT, PRICEACTUAL, PRICEENTERED, LINENETAMT, PRODUCTDESCRIPTION,
@ -13,7 +13,7 @@ SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.
'en_US' AS AD_Language,
ol.C_Order_ID, ol.C_OrderLine_ID, ol.C_Tax_ID, t.TaxIndicator,
ol.C_BPartner_ID, ol.C_BPartner_Location_ID, bp.Name AS BPName, bpl.C_Location_ID,
ol.Line, p.M_Product_ID,
ol.Line, p.M_Product_ID, po.VendorProductNo,
CASE WHEN ol.QtyOrdered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.QtyOrdered END AS QtyOrdered,
CASE WHEN ol.QtyEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.QtyEntered END AS QtyEntered,
CASE WHEN ol.QtyEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol,
@ -37,6 +37,7 @@ FROM C_OrderLine ol
INNER JOIN C_UOM uom ON (ol.C_UOM_ID=uom.C_UOM_ID)
INNER JOIN C_Order i ON (ol.C_Order_ID=i.C_Order_ID)
LEFT OUTER JOIN M_Product p ON (ol.M_Product_ID=p.M_Product_ID)
LEFT OUTER JOIN M_Product_PO po ON (p.M_Product_ID=po.M_Product_ID)
LEFT OUTER JOIN S_ResourceAssignment ra ON (ol.S_ResourceAssignment_ID=ra.S_ResourceAssignment_ID)
LEFT OUTER JOIN C_Charge c ON (ol.C_Charge_ID=c.C_Charge_ID)
LEFT OUTER JOIN C_BPartner_Product pp ON (ol.M_Product_ID=pp.M_Product_ID AND i.C_BPartner_ID=pp.C_BPartner_ID)
@ -48,18 +49,30 @@ SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.
'en_US' AS AD_Language,
ol.C_Order_ID, ol.C_OrderLine_ID, ol.C_Tax_ID, null,
null, null, null, null,
ol.Line+(b.Line/100) AS Line, p.M_Product_ID,
ol.QtyOrdered*b.BOMQty AS QtyInvoiced, ol.QtyEntered*b.BOMQty AS QtyEntered, uom.UOMSymbol,
ol.Line+(bl.Line/100) AS Line, p.M_Product_ID,po.VendorProductNo,
--ol.QtyOrdered*bl.BOMQty AS QtyInvoiced
CASE WHEN bl.IsQtyPercentage = 'N' THEN ol.QtyOrdered*bl.QtyBOM ELSE ol.QtyOrdered*(bl.QtyBatch / 100) END AS QtyInvoiced,
--ol.QtyEntered*bl.BOMQty AS QtyEntered,
CASE WHEN bl.IsQtyPercentage = 'N' THEN ol.QtyEntered*bl.QtyBOM ELSE ol.QtyEntered*(bl.QtyBatch / 100) END AS QtyEntered,
uom.UOMSymbol,
p.Name, -- main
b.Description,
bl.Description,
p.DocumentNote, p.UPC, p.SKU, p.Value AS ProductValue,
null, null, null, null, null, null, null, p.Description as ProductDescription, p.ImageURL,
ol.C_Campaign_ID, ol.C_Project_ID, ol.C_Activity_ID, ol.C_ProjectPhase_ID, ol.C_ProjectTask_ID
FROM M_Product_BOM b -- BOM lines
/*FROM M_Product_BOM b -- BOM lines
INNER JOIN C_OrderLine ol ON (b.M_Product_ID=ol.M_Product_ID)
INNER JOIN M_Product bp ON (bp.M_Product_ID=ol.M_Product_ID -- BOM Product
AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y')
INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) -- BOM line product
INNER JOIN C_UOM uom ON (p.C_UOM_ID=uom.C_UOM_ID)*/
FROM PP_Product_BOM b
INNER JOIN C_OrderLine ol ON (b.M_Product_ID=ol.M_Product_ID)
INNER JOIN M_Product bp ON (bp.M_Product_ID=ol.M_Product_ID -- BOM Product
AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y')
INNER JOIN PP_Product_BOMLine bl ON (bl.PP_Product_BOM_ID=b.PP_Product_BOM_ID)
INNER JOIN M_Product p ON (p.M_Product_ID=bl.M_Product_ID) -- BOM line product
LEFT OUTER JOIN M_Product_PO po ON (p.M_Product_ID=po.M_Product_ID)
INNER JOIN C_UOM uom ON (p.C_UOM_ID=uom.C_UOM_ID)
UNION
SELECT AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,
@ -67,7 +80,7 @@ SELECT AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy
null,
null, null, null,
null, null, null, null,
null, null,
null, null,null,
null, null, null, null, null, null,
null, null, null, null, null, null, null, null,
null,null,null,null,null
@ -76,7 +89,7 @@ UNION
SELECT ot.AD_Client_ID, ot.AD_Org_ID, ot.IsActive, ot.Created, ot.CreatedBy, ot.Updated, ot.UpdatedBy,
'en_US', ot.C_Order_ID, null, ot.C_Tax_ID, t.TaxIndicator,
null, null, null, null,
null, null,
null, null,null,
null, null, null,
t.Name,
null, null, null, null, null, null,
@ -88,6 +101,3 @@ SELECT ot.AD_Client_ID, ot.AD_Org_ID, ot.IsActive, ot.Created, ot.CreatedBy, ot.
null,null,null,null,null
FROM C_OrderTax ot
INNER JOIN C_Tax t ON (ot.C_Tax_ID=t.C_Tax_ID);

View File

@ -2,7 +2,7 @@ CREATE OR REPLACE VIEW C_ORDER_LINETAX_VT
(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
UPDATED, UPDATEDBY, AD_LANGUAGE, C_ORDER_ID, C_ORDERLINE_ID,
C_TAX_ID, TAXINDICATOR, C_BPARTNER_ID, C_BPARTNER_LOCATION_ID, BPNAME,
C_LOCATION_ID, LINE, M_PRODUCT_ID, QTYORDERED, QTYENTERED,
C_LOCATION_ID, LINE, M_PRODUCT_ID,VendorProductNo, QTYORDERED, QTYENTERED,
UOMSYMBOL, NAME, DESCRIPTION, DOCUMENTNOTE, UPC,
SKU, PRODUCTVALUE, RESOURCEDESCRIPTION, PRICELIST, PRICEENTEREDLIST,
DISCOUNT, PRICEACTUAL, PRICEENTERED, LINENETAMT, PRODUCTDESCRIPTION,
@ -13,7 +13,7 @@ SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.
uom.AD_Language,
ol.C_Order_ID, ol.C_OrderLine_ID, ol.C_Tax_ID, t.TaxIndicator,
ol.C_BPartner_ID, ol.C_BPartner_Location_ID, bp.Name AS BPName, bpl.C_Location_ID,
ol.Line, p.M_Product_ID,
ol.Line, p.M_Product_ID,po.VendorProductNo,
CASE WHEN ol.QtyOrdered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.QtyOrdered END AS QtyOrdered,
CASE WHEN ol.QtyEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.QtyEntered END AS QtyEntered,
CASE WHEN ol.QtyEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol,
@ -37,6 +37,7 @@ FROM C_OrderLine ol
INNER JOIN C_UOM_Trl uom ON (ol.C_UOM_ID=uom.C_UOM_ID)
INNER JOIN C_Order i ON (ol.C_Order_ID=i.C_Order_ID)
LEFT OUTER JOIN M_Product p ON (ol.M_Product_ID=p.M_Product_ID)
LEFT OUTER JOIN M_Product_PO po ON (p.M_Product_ID=po.M_Product_ID)
LEFT OUTER JOIN M_Product_Trl pt ON (ol.M_Product_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language)
LEFT OUTER JOIN S_ResourceAssignment ra ON (ol.S_ResourceAssignment_ID=ra.S_ResourceAssignment_ID)
LEFT OUTER JOIN C_Charge c ON (ol.C_Charge_ID=c.C_Charge_ID)
@ -49,27 +50,40 @@ SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.
uom.AD_Language,
ol.C_Order_ID, ol.C_OrderLine_ID, ol.C_Tax_ID, null,
null, null, null, null,
ol.Line+(b.Line/100) AS Line, p.M_Product_ID,
ol.QtyOrdered*b.BOMQty AS QtyInvoiced, ol.QtyEntered*b.BOMQty AS QtyEntered, uom.UOMSymbol,
ol.Line+(bl.Line/100) AS Line, p.M_Product_ID,po.VendorProductNo,
--ol.QtyOrdered*b.BOMQty AS QtyInvoiced,
CASE WHEN bl.IsQtyPercentage = 'N' THEN ol.QtyOrdered*bl.QtyBOM ELSE ol.QtyOrdered*(bl.QtyBatch / 100) END AS QtyInvoiced,
--ol.QtyEntered*b.BOMQty AS QtyEntered,
CASE WHEN bl.IsQtyPercentage = 'N' THEN ol.QtyEntered*bl.QtyBOM ELSE ol.QtyEntered*(bl.QtyBatch / 100) END AS QtyEntered,
uom.UOMSymbol,
COALESCE(pt.Name, p.Name) AS Name, -- main
b.Description,
COALESCE(pt.DocumentNote, p.DocumentNote) AS DocumentNote, p.UPC, p.SKU, p.Value AS ProductValue,
null, null, null, null, null, null, null, pt.Description AS ProductDescription, p.ImageURL,
ol.C_Campaign_ID, ol.C_Project_ID, ol.C_Activity_ID, ol.C_ProjectPhase_ID, ol.C_ProjectTask_ID
FROM M_Product_BOM b -- BOM lines
/*FROM M_Product_BOM b -- BOM lines
INNER JOIN C_OrderLine ol ON (b.M_Product_ID=ol.M_Product_ID)
INNER JOIN M_Product bp ON (bp.M_Product_ID=ol.M_Product_ID -- BOM Product
AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y')
INNER JOIN M_Product p ON (b.M_ProductBOM_ID=p.M_Product_ID) -- BOM line product
INNER JOIN C_UOM_Trl uom ON (p.C_UOM_ID=uom.C_UOM_ID)
INNER JOIN M_Product_Trl pt ON (b.M_ProductBOM_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language)
INNER JOIN M_Product_Trl pt ON (b.M_ProductBOM_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language)*/
FROM PP_Product_BOM b
INNER JOIN C_ORDERLINE ol ON (b.M_Product_ID=ol.M_Product_ID)
INNER JOIN M_PRODUCT bp ON (bp.M_Product_ID=ol.M_Product_ID -- BOM Product
AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsInvoicePrintDetails='Y')
INNER JOIN PP_Product_BOMLine bl ON (bl.PP_Product_BOM_ID=b.PP_Product_BOM_ID)
INNER JOIN M_Product p ON (p.M_Product_ID=bl.M_Product_ID) -- BOM line product
LEFT OUTER JOIN M_Product_PO po ON (p.M_Product_ID=po.M_Product_ID)
INNER JOIN C_UOM_Trl uom ON (p.C_UOM_ID=uom.C_UOM_ID)
INNER JOIN M_Product_Trl pt ON (pt.M_Product_ID=bl.M_Product_ID AND uom.AD_Language=pt.AD_Language)
UNION
SELECT o.AD_Client_ID, o.AD_Org_ID, o.IsActive, o.Created, o.CreatedBy, o.Updated, o.UpdatedBy,
l.AD_Language, o.C_Order_ID, null, null, null,
null,
null, null, null,
null, null, null, null,
null, null,
null, null,null,
null, null, null, null, null, null,
null, null, null, null, null, null, null, null,
null,null,null,null,null
@ -79,7 +93,7 @@ UNION
SELECT ot.AD_Client_ID, ot.AD_Org_ID, ot.IsActive, ot.Created, ot.CreatedBy, ot.Updated, ot.UpdatedBy,
t.AD_Language, ot.C_Order_ID, null, ot.C_Tax_ID, t.TaxIndicator,
null, null, null, null,
null, null,
null, null,null,
null, null, null,
t.Name,
null, null, null, null, null, null,
@ -91,6 +105,3 @@ SELECT ot.AD_Client_ID, ot.AD_Org_ID, ot.IsActive, ot.Created, ot.CreatedBy, ot.
null,null,null,null,null
FROM C_OrderTax ot
INNER JOIN C_Tax_Trl t ON (ot.C_Tax_ID=t.C_Tax_ID);

View File

@ -37,8 +37,12 @@ UNION -- BOM lines
SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy, iol.Updated, iol.UpdatedBy,
'en_US' AS AD_Language,
iol.M_InOut_ID, iol.M_InOutLine_ID,
iol.Line+(b.Line/100) AS Line, p.M_Product_ID,
iol.MovementQty*b.BOMQty AS QtyInvoiced, iol.QtyEntered*b.BOMQty AS QtyEntered, uom.UOMSymbol,
iol.Line+(bl.Line/100) AS Line, p.M_Product_ID,
--iol.MovementQty*b.BOMQty AS QtyInvoiced,
CASE WHEN bl.IsQtyPercentage = 'N' THEN iol.MovementQty*bl.QtyBOM ELSE iol.MovementQty*(bl.QtyBatch / 100) END AS QtyInvoiced,
--iol.QtyEntered*b.BOMQty AS QtyEntered,
CASE WHEN bl.IsQtyPercentage = 'N' THEN iol.QtyEntered*bl.QtyBOM ELSE iol.QtyEntered*(bl.QtyBatch / 100) END AS QtyEntered,
uom.UOMSymbol,
null, null, null,
p.Name, -- main line
b.Description, -- second line
@ -48,7 +52,7 @@ SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy
iol.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate,
p.Description AS ProductDescription, p.ImageURL,
iol.C_Campaign_ID, iol.C_Project_ID, iol.C_Activity_ID, iol.C_ProjectPhase_ID, iol.C_ProjectTask_ID
FROM M_Product_BOM b -- BOM lines
/*FROM M_Product_BOM b -- BOM lines
INNER JOIN M_InOutLine iol ON (b.M_Product_ID=iol.M_Product_ID)
INNER JOIN M_Product bp ON (bp.M_Product_ID=iol.M_Product_ID -- BOM Product
AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsPickListPrintDetails='Y')
@ -56,6 +60,13 @@ FROM M_Product_BOM b -- BOM lines
INNER JOIN C_UOM uom ON (p.C_UOM_ID=uom.C_UOM_ID)
LEFT OUTER JOIN M_AttributeSetInstance asi ON (iol.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
LEFT OUTER JOIN M_Locator l ON (iol.M_Locator_ID=l.M_Locator_ID);
*/
FROM PP_Product_BOM b -- BOM lines
INNER JOIN M_InOutLine iol ON (b.M_Product_ID=iol.M_Product_ID)
INNER JOIN M_Product bp ON (bp.M_Product_ID=iol.M_Product_ID -- BOM Product
AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsPickListPrintDetails='Y')
INNER JOIN PP_Product_BOMLine bl ON (bl.PP_Product_BOM_ID=b.PP_Product_BOM_ID)
INNER JOIN M_Product p ON (bl.M_Product_ID=p.M_Product_ID) -- BOM line product
INNER JOIN C_UOM uom ON (p.C_UOM_ID=uom.C_UOM_ID)
LEFT OUTER JOIN M_AttributeSetInstance asi ON (iol.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
LEFT OUTER JOIN M_Locator l ON (iol.M_Locator_ID=l.M_Locator_ID);

View File

@ -38,8 +38,12 @@ UNION
SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy, iol.Updated, iol.UpdatedBy,
uom.AD_Language,
iol.M_InOut_ID, iol.M_InOutLine_ID,
iol.Line+(b.Line/100) AS Line, p.M_Product_ID,
iol.MovementQty*b.BOMQty AS QtyInvoiced, iol.QtyEntered*b.BOMQty AS QtyEntered, uom.UOMSymbol,
iol.Line+(bl.Line/100) AS Line, p.M_Product_ID,
--iol.MovementQty*b.BOMQty AS QtyInvoiced,
CASE WHEN bl.IsQtyPercentage = 'N' THEN iol.MovementQty*bl.QtyBOM ELSE iol.MovementQty*(bl.QtyBatch / 100) END AS QtyInvoiced,
--iol.QtyEntered*b.BOMQty AS QtyEntered,
CASE WHEN bl.IsQtyPercentage = 'N' THEN iol.QtyEntered*bl.QtyBOM ELSE iol.QtyEntered*(bl.QtyBatch / 100) END AS QtyEntered,
uom.UOMSymbol,
null, null, null,
COALESCE (pt.Name, p.Name) AS Name, -- main line
b.Description, -- second line
@ -49,7 +53,7 @@ SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy
iol.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate,
pt.Description AS ProductDescription, p.ImageURL,
iol.C_Campaign_ID, iol.C_Project_ID, iol.C_Activity_ID, iol.C_ProjectPhase_ID, iol.C_ProjectTask_ID
FROM M_Product_BOM b -- BOM lines
/*FROM M_Product_BOM b -- BOM lines
INNER JOIN M_InOutLine iol ON (b.M_Product_ID=iol.M_Product_ID)
INNER JOIN M_Product bp ON (bp.M_Product_ID=iol.M_Product_ID -- BOM Product
AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsPickListPrintDetails='Y')
@ -57,7 +61,14 @@ FROM M_Product_BOM b -- BOM lines
INNER JOIN C_UOM_Trl uom ON (p.C_UOM_ID=uom.C_UOM_ID)
INNER JOIN M_Product_Trl pt ON (iol.M_Product_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language)
LEFT OUTER JOIN M_AttributeSetInstance asi ON (iol.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
LEFT OUTER JOIN M_Locator l ON (iol.M_Locator_ID=l.M_Locator_ID);*/
FROM PP_Product_BOM b -- BOM lines
INNER JOIN M_InOutLine iol ON (b.M_Product_ID=iol.M_Product_ID)
INNER JOIN M_Product bp ON (bp.M_Product_ID=iol.M_Product_ID -- BOM Product
AND bp.IsBOM='Y' AND bp.IsVerified='Y' AND bp.IsPickListPrintDetails='Y')
INNER JOIN PP_Product_BOMLine bl ON (bl.PP_Product_BOM_ID=b.PP_Product_BOM_ID)
INNER JOIN M_Product p ON (bl.M_Product_ID=p.M_Product_ID) -- BOM line product
INNER JOIN C_UOM_Trl uom ON (p.C_UOM_ID=uom.C_UOM_ID)
INNER JOIN M_Product_Trl pt ON (iol.M_Product_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language)
LEFT OUTER JOIN M_AttributeSetInstance asi ON (iol.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
LEFT OUTER JOIN M_Locator l ON (iol.M_Locator_ID=l.M_Locator_ID);