Fix problems in migration scripts with comment on view
This commit is contained in:
parent
68ce79b109
commit
b88b649f63
|
@ -10,7 +10,7 @@ CREATE OR REPLACE VIEW M_INOUT_LINE_V
|
|||
C_PROJECTPHASE_ID, C_PROJECTTASK_ID)
|
||||
AS
|
||||
SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy, iol.Updated, iol.UpdatedBy,
|
||||
'en_US' AS AD_Language,
|
||||
'en_US' AS AD_LANGUAGE,
|
||||
iol.M_InOut_ID, iol.M_InOutLine_ID,
|
||||
iol.Line, p.M_Product_ID,
|
||||
CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN iol.MovementQty END AS MovementQty,
|
||||
|
@ -18,24 +18,24 @@ SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy
|
|||
CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol,
|
||||
ol.QtyOrdered, ol.QtyDelivered,
|
||||
CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN ol.QtyOrdered-ol.QtyDelivered END AS QtyBackOrdered,
|
||||
COALESCE(p.Name||productAttribute(iol.M_AttributeSetInstance_ID), c.Name, iol.Description) AS Name, -- main line
|
||||
CASE WHEN COALESCE(c.Name,p.Name) IS NOT NULL THEN iol.Description END AS Description, -- second line
|
||||
COALESCE(p.NAME||Productattribute(iol.M_AttributeSetInstance_ID), c.NAME, iol.Description) AS NAME, -- main line
|
||||
CASE WHEN COALESCE(c.NAME,p.NAME) IS NOT NULL THEN iol.Description END AS Description, -- second line
|
||||
p.DocumentNote, -- third line
|
||||
p.UPC, p.SKU, p.Value AS ProductValue,
|
||||
p.UPC, p.SKU, p.VALUE AS ProductValue,
|
||||
iol.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z,
|
||||
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_InOutLine iol
|
||||
FROM M_INOUTLINE iol
|
||||
INNER JOIN C_UOM uom ON (iol.C_UOM_ID=uom.C_UOM_ID)
|
||||
LEFT OUTER JOIN M_Product p ON (iol.M_Product_ID=p.M_Product_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)
|
||||
LEFT OUTER JOIN C_OrderLine ol ON (iol.C_OrderLine_ID=ol.C_OrderLine_ID)
|
||||
LEFT OUTER JOIN C_Charge c ON (iol.C_Charge_ID=c.C_Charge_ID)
|
||||
LEFT OUTER JOIN M_PRODUCT p ON (iol.M_Product_ID=p.M_Product_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)
|
||||
LEFT OUTER JOIN C_ORDERLINE ol ON (iol.C_OrderLine_ID=ol.C_OrderLine_ID)
|
||||
LEFT OUTER JOIN C_CHARGE c ON (iol.C_Charge_ID=c.C_Charge_ID)
|
||||
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,
|
||||
'en_US' AS AD_LANGUAGE,
|
||||
iol.M_InOut_ID, iol.M_InOutLine_ID,
|
||||
iol.Line+(bl.Line/100) AS Line, p.M_Product_ID,
|
||||
--iol.MovementQty*b.BOMQty AS QtyInvoiced,
|
||||
|
@ -43,11 +43,11 @@ SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy
|
|||
--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
|
||||
NULL, NULL, NULL,
|
||||
p.NAME, -- main line
|
||||
b.Description, -- second line
|
||||
p.DocumentNote, -- third line
|
||||
p.UPC, p.SKU, p.Value AS ProductValue,
|
||||
p.UPC, p.SKU, p.VALUE AS ProductValue,
|
||||
iol.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z,
|
||||
iol.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate,
|
||||
p.Description AS ProductDescription, p.ImageURL,
|
||||
|
@ -59,14 +59,13 @@ SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy
|
|||
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 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
|
||||
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 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);
|
||||
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);
|
|
@ -10,17 +10,17 @@ CREATE OR REPLACE VIEW C_INVOICE_LINETAX_V
|
|||
C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, C_PROJECTPHASE_ID, C_PROJECTTASK_ID)
|
||||
AS
|
||||
SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy,
|
||||
'en_US' AS AD_Language,
|
||||
'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, p.M_Product_ID,
|
||||
CASE WHEN il.QtyInvoiced<>0 OR il.M_Product_ID IS NOT NULL THEN il.QtyInvoiced END AS QtyInvoiced,
|
||||
CASE WHEN il.QtyEntered<>0 OR il.M_Product_ID IS NOT NULL THEN il.QtyEntered END AS QtyEntered,
|
||||
CASE WHEN il.QtyEntered<>0 OR il.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol,
|
||||
COALESCE(c.Name,p.Name||productAttribute(il.M_AttributeSetInstance_ID), il.Description) AS Name, -- main line
|
||||
CASE WHEN COALESCE(c.Name,p.Name) IS NOT NULL THEN il.Description END AS Description, -- second line
|
||||
COALESCE(c.NAME,p.NAME||Productattribute(il.M_AttributeSetInstance_ID), il.Description) AS NAME, -- main line
|
||||
CASE WHEN COALESCE(c.NAME,p.NAME) IS NOT NULL THEN il.Description END AS Description, -- second line
|
||||
p.DocumentNote, -- third line
|
||||
p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.Value) AS ProductValue,
|
||||
p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.VALUE) AS ProductValue,
|
||||
ra.Description AS ResourceDescription, -- forth line
|
||||
CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList<>0
|
||||
THEN il.PriceList END AS PriceList,
|
||||
|
@ -33,20 +33,20 @@ SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.
|
|||
CASE WHEN il.LineNetAmt<>0 OR il.M_Product_ID IS NOT NULL THEN il.LineNetAmt END AS LineNetAmt,
|
||||
il.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID,
|
||||
asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate,
|
||||
p.Description as ProductDescription, p.ImageURL,
|
||||
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 C_InvoiceLine il
|
||||
FROM C_INVOICELINE il
|
||||
INNER JOIN C_UOM uom ON (il.C_UOM_ID=uom.C_UOM_ID)
|
||||
INNER JOIN C_Invoice i ON (il.C_Invoice_ID=i.C_Invoice_ID)
|
||||
LEFT OUTER JOIN C_Tax t ON (il.C_Tax_ID=t.C_Tax_ID)
|
||||
LEFT OUTER JOIN M_Product p ON (il.M_Product_ID=p.M_Product_ID)
|
||||
LEFT OUTER JOIN C_Charge c ON (il.C_Charge_ID=c.C_Charge_ID)
|
||||
LEFT OUTER JOIN C_BPartner_Product pp ON (il.M_Product_ID=pp.M_Product_ID AND i.C_BPartner_ID=pp.C_BPartner_ID)
|
||||
LEFT OUTER JOIN S_ResourceAssignment ra ON (il.S_ResourceAssignment_ID=ra.S_ResourceAssignment_ID)
|
||||
LEFT OUTER JOIN M_AttributeSetInstance asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
|
||||
INNER JOIN C_INVOICE i ON (il.C_Invoice_ID=i.C_Invoice_ID)
|
||||
LEFT OUTER JOIN C_TAX t ON (il.C_Tax_ID=t.C_Tax_ID)
|
||||
LEFT OUTER JOIN M_PRODUCT p ON (il.M_Product_ID=p.M_Product_ID)
|
||||
LEFT OUTER JOIN C_CHARGE c ON (il.C_Charge_ID=c.C_Charge_ID)
|
||||
LEFT OUTER JOIN C_BPARTNER_PRODUCT pp ON (il.M_Product_ID=pp.M_Product_ID AND i.C_BPartner_ID=pp.C_BPartner_ID)
|
||||
LEFT OUTER JOIN S_RESOURCEASSIGNMENT ra ON (il.S_ResourceAssignment_ID=ra.S_ResourceAssignment_ID)
|
||||
LEFT OUTER JOIN M_ATTRIBUTESETINSTANCE asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
|
||||
UNION -- bom lines
|
||||
SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy,
|
||||
'en_US' AS AD_Language,
|
||||
'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+(bl.Line/100) AS Line, p.M_Product_ID,
|
||||
|
@ -55,12 +55,12 @@ SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.
|
|||
--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
|
||||
p.NAME, -- main
|
||||
b.Description,
|
||||
p.DocumentNote, p.UPC, p.SKU, p.Value AS ProductValue,
|
||||
null, null, null, null, null, null, null,
|
||||
p.DocumentNote, p.UPC, p.SKU, p.VALUE AS ProductValue,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
il.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate,
|
||||
p.Description as ProductDescription, p.ImageURL,
|
||||
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
|
||||
INNER JOIN C_InvoiceLine il ON (b.M_Product_ID=il.M_Product_ID)
|
||||
|
@ -70,56 +70,56 @@ SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.
|
|||
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
|
||||
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 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)
|
||||
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,
|
||||
'en_US', il.C_Invoice_ID, il.C_InvoiceLine_ID,
|
||||
null, null, null, null,
|
||||
il.Line, null,
|
||||
null, null, null,
|
||||
NULL, NULL, NULL, NULL,
|
||||
il.Line, NULL,
|
||||
NULL, NULL, NULL,
|
||||
il.Description,
|
||||
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
|
||||
FROM C_InvoiceLine il
|
||||
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
|
||||
FROM C_INVOICELINE il
|
||||
WHERE il.C_UOM_ID IS NULL
|
||||
UNION -- empty line
|
||||
SELECT AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,
|
||||
'en_US', C_Invoice_ID, null,
|
||||
null, null, null, null,
|
||||
9998, 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
|
||||
FROM C_Invoice
|
||||
'en_US', C_Invoice_ID, NULL,
|
||||
NULL, NULL, NULL, NULL,
|
||||
9998, 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
|
||||
FROM C_INVOICE
|
||||
UNION -- tax lines
|
||||
SELECT it.AD_Client_ID, it.AD_Org_ID, it.IsActive, it.Created, it.CreatedBy, it.Updated, it.UpdatedBy,
|
||||
'en_US', it.C_Invoice_ID, null,
|
||||
it.C_Tax_ID, null, null, t.TaxIndicator,
|
||||
9999, null,
|
||||
null, null, null,
|
||||
t.Name,
|
||||
null, null, null, null, null, null,
|
||||
null, null, null,
|
||||
'en_US', it.C_Invoice_ID, NULL,
|
||||
it.C_Tax_ID, NULL, NULL, t.TaxIndicator,
|
||||
9999, NULL,
|
||||
NULL, NULL, NULL,
|
||||
t.NAME,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL,
|
||||
CASE WHEN it.IsTaxIncluded='Y' THEN it.TaxAmt ELSE it.TaxBaseAmt END,
|
||||
CASE WHEN it.IsTaxIncluded='Y' THEN it.TaxAmt ELSE it.TaxBaseAmt END,
|
||||
CASE WHEN it.IsTaxIncluded='Y' THEN NULL ELSE it.TaxAmt END,
|
||||
null, null, null, null, null, null, null, null,
|
||||
null, null, null, null, null
|
||||
FROM C_InvoiceTax it
|
||||
INNER JOIN C_Tax t ON (it.C_Tax_ID=t.C_Tax_ID);
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL
|
||||
FROM C_INVOICETAX it
|
||||
INNER JOIN C_TAX t ON (it.C_Tax_ID=t.C_Tax_ID);
|
||||
|
||||
CREATE OR REPLACE VIEW C_INVOICE_LINETAX_VT
|
||||
(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
|
||||
|
@ -133,17 +133,17 @@ CREATE OR REPLACE VIEW C_INVOICE_LINETAX_VT
|
|||
C_CAMPAIGN_ID, C_PROJECT_ID, C_ACTIVITY_ID, C_PROJECTPHASE_ID, C_PROJECTTASK_ID)
|
||||
AS
|
||||
SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy,
|
||||
uom.AD_Language,
|
||||
uom.AD_LANGUAGE,
|
||||
il.C_Invoice_ID, il.C_InvoiceLine_ID,
|
||||
il.C_Tax_ID, il.TaxAmt, il.LineTotalAmt, t.TaxIndicator,
|
||||
il.Line, p.M_Product_ID,
|
||||
CASE WHEN il.QtyInvoiced<>0 OR il.M_Product_ID IS NOT NULL THEN il.QtyInvoiced END AS QtyInvoiced,
|
||||
CASE WHEN il.QtyEntered<>0 OR il.M_Product_ID IS NOT NULL THEN il.QtyEntered END AS QtyEntered,
|
||||
CASE WHEN il.QtyEntered<>0 OR il.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol,
|
||||
COALESCE(c.Name,COALESCE(pt.Name,p.Name)||productAttribute(il.M_AttributeSetInstance_ID), il.Description) AS Name, -- main line
|
||||
CASE WHEN COALESCE(c.Name,pt.Name,p.Name) IS NOT NULL THEN il.Description END AS Description, -- second line
|
||||
COALESCE(c.NAME,COALESCE(pt.NAME,p.NAME)||Productattribute(il.M_AttributeSetInstance_ID), il.Description) AS NAME, -- main line
|
||||
CASE WHEN COALESCE(c.NAME,pt.NAME,p.NAME) IS NOT NULL THEN il.Description END AS Description, -- second line
|
||||
COALESCE(pt.DocumentNote,p.DocumentNote) AS DocumentNote, -- third line
|
||||
p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.Value) AS ProductValue,
|
||||
p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.VALUE) AS ProductValue,
|
||||
ra.Description AS ResourceDescription, -- forth line
|
||||
CASE WHEN i.IsDiscountPrinted='Y' AND il.PriceList<>0
|
||||
THEN il.PriceList END AS PriceList,
|
||||
|
@ -155,21 +155,21 @@ SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.
|
|||
CASE WHEN il.PriceEntered<>0 OR il.M_Product_ID IS NOT NULL THEN il.PriceEntered END AS PriceEntered,
|
||||
CASE WHEN il.LineNetAmt<>0 OR il.M_Product_ID IS NOT NULL THEN il.LineNetAmt END AS LineNetAmt,
|
||||
il.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate,
|
||||
pt.Description as ProductDescription, p.ImageURL,
|
||||
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 C_InvoiceLine il
|
||||
INNER JOIN C_UOM_Trl uom ON (il.C_UOM_ID=uom.C_UOM_ID)
|
||||
INNER JOIN C_Invoice i ON (il.C_Invoice_ID=i.C_Invoice_ID)
|
||||
LEFT OUTER JOIN C_Tax_Trl t ON (il.C_Tax_ID=t.C_Tax_ID AND uom.AD_Language=t.AD_Language)
|
||||
LEFT OUTER JOIN M_Product p ON (il.M_Product_ID=p.M_Product_ID)
|
||||
LEFT OUTER JOIN C_Charge c ON (il.C_Charge_ID=c.C_Charge_ID)
|
||||
LEFT OUTER JOIN C_BPartner_Product pp ON (il.M_Product_ID=pp.M_Product_ID AND i.C_BPartner_ID=pp.C_BPartner_ID)
|
||||
LEFT OUTER JOIN M_Product_Trl pt ON (il.M_Product_ID=pt.M_Product_ID AND uom.AD_Language=pt.AD_Language)
|
||||
LEFT OUTER JOIN S_ResourceAssignment ra ON (il.S_ResourceAssignment_ID=ra.S_ResourceAssignment_ID)
|
||||
LEFT OUTER JOIN M_AttributeSetInstance asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
|
||||
FROM C_INVOICELINE il
|
||||
INNER JOIN C_UOM_TRL uom ON (il.C_UOM_ID=uom.C_UOM_ID)
|
||||
INNER JOIN C_INVOICE i ON (il.C_Invoice_ID=i.C_Invoice_ID)
|
||||
LEFT OUTER JOIN C_TAX_TRL t ON (il.C_Tax_ID=t.C_Tax_ID AND uom.AD_LANGUAGE=t.AD_LANGUAGE)
|
||||
LEFT OUTER JOIN M_PRODUCT p ON (il.M_Product_ID=p.M_Product_ID)
|
||||
LEFT OUTER JOIN C_CHARGE c ON (il.C_Charge_ID=c.C_Charge_ID)
|
||||
LEFT OUTER JOIN C_BPARTNER_PRODUCT pp ON (il.M_Product_ID=pp.M_Product_ID AND i.C_BPartner_ID=pp.C_BPartner_ID)
|
||||
LEFT OUTER JOIN M_PRODUCT_TRL pt ON (il.M_Product_ID=pt.M_Product_ID AND uom.AD_LANGUAGE=pt.AD_LANGUAGE)
|
||||
LEFT OUTER JOIN S_RESOURCEASSIGNMENT ra ON (il.S_ResourceAssignment_ID=ra.S_ResourceAssignment_ID)
|
||||
LEFT OUTER JOIN M_ATTRIBUTESETINSTANCE asi ON (il.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
|
||||
UNION -- bom lines
|
||||
SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.Updated, il.UpdatedBy,
|
||||
uom.AD_Language,
|
||||
uom.AD_LANGUAGE,
|
||||
il.C_Invoice_ID, il.C_InvoiceLine_ID,
|
||||
il.C_Tax_ID, il.TaxAmt, il.LineTotalAmt, t.TaxIndicator,
|
||||
il.Line+(bl.Line/100) AS Line, p.M_Product_ID,
|
||||
|
@ -178,12 +178,12 @@ SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.
|
|||
--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
|
||||
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,
|
||||
COALESCE(pt.DocumentNote,p.DocumentNote) AS DocumentNote, p.UPC, p.SKU, p.VALUE AS ProductValue,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
il.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate,
|
||||
pt.Description as ProductDescription, p.ImageURL,
|
||||
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
|
||||
INNER JOIN C_InvoiceLine il ON (b.M_Product_ID=il.M_Product_ID)
|
||||
|
@ -194,59 +194,59 @@ SELECT il.AD_Client_ID, il.AD_Org_ID, il.IsActive, il.Created, il.CreatedBy, il.
|
|||
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
|
||||
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)
|
||||
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,
|
||||
l.AD_Language, il.C_Invoice_ID, il.C_InvoiceLine_ID,
|
||||
null, null, null, null,
|
||||
il.Line, null,
|
||||
null, null, null,
|
||||
l.AD_LANGUAGE, il.C_Invoice_ID, il.C_InvoiceLine_ID,
|
||||
NULL, NULL, NULL, NULL,
|
||||
il.Line, NULL,
|
||||
NULL, NULL, NULL,
|
||||
il.Description,
|
||||
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
|
||||
FROM C_InvoiceLine il, AD_Language l
|
||||
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
|
||||
FROM C_INVOICELINE il, AD_LANGUAGE l
|
||||
WHERE il.C_UOM_ID IS NULL
|
||||
AND l.IsBaseLanguage='N' AND l.IsSystemLanguage='Y'
|
||||
UNION -- empty line
|
||||
SELECT i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy,
|
||||
AD_Language, i.C_Invoice_ID, null,
|
||||
null, null, null, null,
|
||||
9998, 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
|
||||
FROM C_Invoice i, AD_Language l
|
||||
AD_LANGUAGE, i.C_Invoice_ID, NULL,
|
||||
NULL, NULL, NULL, NULL,
|
||||
9998, 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
|
||||
FROM C_INVOICE i, AD_LANGUAGE l
|
||||
WHERE l.IsBaseLanguage='N' AND l.IsSystemLanguage='Y'
|
||||
UNION -- tax lines
|
||||
SELECT it.AD_Client_ID, it.AD_Org_ID, it.IsActive, it.Created, it.CreatedBy, it.Updated, it.UpdatedBy,
|
||||
t.AD_Language, it.C_Invoice_ID, null,
|
||||
it.C_Tax_ID, null, null, t.TaxIndicator,
|
||||
9999, null,
|
||||
null, null, null,
|
||||
t.Name,
|
||||
null, null, null, null, null, null,
|
||||
null, null, null,
|
||||
t.AD_LANGUAGE, it.C_Invoice_ID, NULL,
|
||||
it.C_Tax_ID, NULL, NULL, t.TaxIndicator,
|
||||
9999, NULL,
|
||||
NULL, NULL, NULL,
|
||||
t.NAME,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL,
|
||||
CASE WHEN it.IsTaxIncluded='Y' THEN it.TaxAmt ELSE it.TaxBaseAmt END,
|
||||
CASE WHEN it.IsTaxIncluded='Y' THEN it.TaxAmt ELSE it.TaxBaseAmt END,
|
||||
CASE WHEN it.IsTaxIncluded='Y' THEN NULL ELSE it.TaxAmt END,
|
||||
null, null, null, null, null, null, null, null,
|
||||
null,null,null,null,null
|
||||
FROM C_InvoiceTax it
|
||||
INNER JOIN C_Tax_Trl t ON (it.C_Tax_ID=t.C_Tax_ID);
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL,NULL,NULL,NULL,NULL
|
||||
FROM C_INVOICETAX it
|
||||
INNER JOIN C_TAX_TRL t ON (it.C_Tax_ID=t.C_Tax_ID);
|
||||
|
||||
|
||||
|
||||
|
@ -262,17 +262,17 @@ CREATE OR REPLACE VIEW C_ORDER_LINETAX_V
|
|||
C_PROJECTTASK_ID)
|
||||
AS
|
||||
SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.Updated, ol.UpdatedBy,
|
||||
'en_US' AS AD_Language,
|
||||
'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.C_BPartner_ID, ol.C_BPartner_Location_ID, bp.NAME AS BPName, bpl.C_Location_ID,
|
||||
ol.Line, p.M_Product_ID,
|
||||
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,
|
||||
COALESCE(c.Name,p.Name||productAttribute(ol.M_AttributeSetInstance_ID), ol.Description) AS Name, -- main line
|
||||
CASE WHEN COALESCE(c.Name,p.Name) IS NOT NULL THEN ol.Description END AS Description, -- second line
|
||||
COALESCE(c.NAME,p.NAME||Productattribute(ol.M_AttributeSetInstance_ID), ol.Description) AS NAME, -- main line
|
||||
CASE WHEN COALESCE(c.NAME,p.NAME) IS NOT NULL THEN ol.Description END AS Description, -- second line
|
||||
p.DocumentNote, -- third line
|
||||
p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.Value) AS ProductValue,
|
||||
p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.VALUE) AS ProductValue,
|
||||
ra.Description AS ResourceDescription, -- forth line
|
||||
CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList<>0
|
||||
THEN ol.PriceList END AS PriceList,
|
||||
|
@ -283,33 +283,33 @@ SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.
|
|||
CASE WHEN ol.PriceActual<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.PriceActual END AS PriceActual,
|
||||
CASE WHEN ol.PriceEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.PriceEntered END AS PriceEntered,
|
||||
CASE WHEN ol.LineNetAmt<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.LineNetAmt END AS LineNetAmt,
|
||||
p.Description as ProductDescription, p.ImageURL,
|
||||
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 C_OrderLine ol
|
||||
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 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)
|
||||
INNER JOIN C_BPartner bp ON (ol.C_BPartner_ID=bp.C_BPartner_ID)
|
||||
INNER JOIN C_BPartner_Location bpl ON (ol.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID)
|
||||
LEFT OUTER JOIN C_Tax t ON (ol.C_Tax_ID=t.C_Tax_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 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)
|
||||
INNER JOIN C_BPARTNER bp ON (ol.C_BPartner_ID=bp.C_BPartner_ID)
|
||||
INNER JOIN C_BPARTNER_LOCATION bpl ON (ol.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID)
|
||||
LEFT OUTER JOIN C_TAX t ON (ol.C_Tax_ID=t.C_Tax_ID)
|
||||
UNION
|
||||
SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.Updated, ol.UpdatedBy,
|
||||
'en_US' AS AD_Language,
|
||||
ol.C_Order_ID, ol.C_OrderLine_ID, ol.C_Tax_ID, null,
|
||||
null, null, null, null,
|
||||
'en_US' AS AD_LANGUAGE,
|
||||
ol.C_Order_ID, ol.C_OrderLine_ID, ol.C_Tax_ID, NULL,
|
||||
NULL, NULL, NULL, NULL,
|
||||
ol.Line+(bl.Line/100) AS Line, p.M_Product_ID,
|
||||
--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
|
||||
p.NAME, -- main
|
||||
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,
|
||||
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
|
||||
INNER JOIN C_OrderLine ol ON (b.M_Product_ID=ol.M_Product_ID)
|
||||
|
@ -317,40 +317,40 @@ SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.
|
|||
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
|
||||
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
|
||||
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
|
||||
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,
|
||||
'en_US', 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
|
||||
FROM C_Order
|
||||
'en_US', 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
|
||||
FROM C_ORDER
|
||||
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,
|
||||
t.Name,
|
||||
null, null, null, null, null, null,
|
||||
null, null, null,
|
||||
'en_US', ot.C_Order_ID, NULL, ot.C_Tax_ID, t.TaxIndicator,
|
||||
NULL, NULL, NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL, NULL,
|
||||
t.NAME,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL,
|
||||
CASE WHEN ot.IsTaxIncluded='Y' THEN ot.TaxAmt ELSE ot.TaxBaseAmt END,
|
||||
CASE WHEN ot.IsTaxIncluded='Y' THEN ot.TaxAmt ELSE ot.TaxBaseAmt END,
|
||||
CASE WHEN ot.IsTaxIncluded='Y' THEN NULL ELSE ot.TaxAmt END,
|
||||
null, null,
|
||||
null,null,null,null,null
|
||||
FROM C_OrderTax ot
|
||||
INNER JOIN C_Tax t ON (ot.C_Tax_ID=t.C_Tax_ID);
|
||||
NULL, NULL,
|
||||
NULL,NULL,NULL,NULL,NULL
|
||||
FROM C_ORDERTAX ot
|
||||
INNER JOIN C_TAX t ON (ot.C_Tax_ID=t.C_Tax_ID);
|
||||
|
||||
|
||||
|
||||
|
@ -366,17 +366,17 @@ CREATE OR REPLACE VIEW C_ORDER_LINETAX_VT
|
|||
C_PROJECTTASK_ID)
|
||||
AS
|
||||
SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.Updated, ol.UpdatedBy,
|
||||
uom.AD_Language,
|
||||
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.C_BPartner_ID, ol.C_BPartner_Location_ID, bp.NAME AS BPName, bpl.C_Location_ID,
|
||||
ol.Line, p.M_Product_ID,
|
||||
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,
|
||||
COALESCE(c.Name,p.Name||productAttribute(ol.M_AttributeSetInstance_ID), ol.Description) AS Name, -- main line
|
||||
CASE WHEN COALESCE(c.Name,pt.Name, p.Name) IS NOT NULL THEN ol.Description END AS Description, -- second line
|
||||
COALESCE(c.NAME,p.NAME||Productattribute(ol.M_AttributeSetInstance_ID), ol.Description) AS NAME, -- main line
|
||||
CASE WHEN COALESCE(c.NAME,pt.NAME, p.NAME) IS NOT NULL THEN ol.Description END AS Description, -- second line
|
||||
COALESCE(pt.DocumentNote, p.DocumentNote) AS DocumentNote, -- third line
|
||||
p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.Value) AS ProductValue,
|
||||
p.UPC, p.SKU, COALESCE(pp.VendorProductNo,p.VALUE) AS ProductValue,
|
||||
ra.Description AS ResourceDescription, -- forth line
|
||||
CASE WHEN i.IsDiscountPrinted='Y' AND ol.PriceList<>0
|
||||
THEN ol.PriceList END AS PriceList,
|
||||
|
@ -387,34 +387,34 @@ SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.
|
|||
CASE WHEN ol.PriceActual<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.PriceActual END AS PriceActual,
|
||||
CASE WHEN ol.PriceEntered<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.PriceEntered END AS PriceEntered,
|
||||
CASE WHEN ol.LineNetAmt<>0 OR ol.M_Product_ID IS NOT NULL THEN ol.LineNetAmt END AS LineNetAmt,
|
||||
pt.Description as ProductDescription, p.ImageURL,
|
||||
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 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_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)
|
||||
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)
|
||||
INNER JOIN C_BPartner bp ON (ol.C_BPartner_ID=bp.C_BPartner_ID)
|
||||
INNER JOIN C_BPartner_Location bpl ON (ol.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID)
|
||||
LEFT OUTER JOIN C_Tax_Trl t ON (ol.C_Tax_ID=t.C_Tax_ID AND uom.AD_Language=t.AD_Language)
|
||||
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_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)
|
||||
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)
|
||||
INNER JOIN C_BPARTNER bp ON (ol.C_BPartner_ID=bp.C_BPartner_ID)
|
||||
INNER JOIN C_BPARTNER_LOCATION bpl ON (ol.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID)
|
||||
LEFT OUTER JOIN C_TAX_TRL t ON (ol.C_Tax_ID=t.C_Tax_ID AND uom.AD_LANGUAGE=t.AD_LANGUAGE)
|
||||
UNION
|
||||
SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.Updated, ol.UpdatedBy,
|
||||
uom.AD_Language,
|
||||
ol.C_Order_ID, ol.C_OrderLine_ID, ol.C_Tax_ID, null,
|
||||
null, null, null, null,
|
||||
uom.AD_LANGUAGE,
|
||||
ol.C_Order_ID, ol.C_OrderLine_ID, ol.C_Tax_ID, NULL,
|
||||
NULL, NULL, NULL, NULL,
|
||||
ol.Line+(bl.Line/100) AS Line, p.M_Product_ID,
|
||||
--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
|
||||
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,
|
||||
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
|
||||
INNER JOIN C_OrderLine ol ON (b.M_Product_ID=ol.M_Product_ID)
|
||||
|
@ -423,42 +423,42 @@ SELECT ol.AD_Client_ID, ol.AD_Org_ID, ol.IsActive, ol.Created, ol.CreatedBy, ol.
|
|||
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)*/
|
||||
FROM PP_Product_BOM b
|
||||
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
|
||||
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)
|
||||
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
|
||||
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
|
||||
FROM C_Order o, AD_Language l
|
||||
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
|
||||
FROM C_ORDER o, AD_LANGUAGE l
|
||||
WHERE l.IsBaseLanguage='N' AND l.IsSystemLanguage='Y'
|
||||
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,
|
||||
t.Name,
|
||||
null, null, null, null, null, null,
|
||||
null, null, null,
|
||||
t.AD_LANGUAGE, ot.C_Order_ID, NULL, ot.C_Tax_ID, t.TaxIndicator,
|
||||
NULL, NULL, NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL, NULL,
|
||||
t.NAME,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL,
|
||||
CASE WHEN ot.IsTaxIncluded='Y' THEN ot.TaxAmt ELSE ot.TaxBaseAmt END,
|
||||
CASE WHEN ot.IsTaxIncluded='Y' THEN ot.TaxAmt ELSE ot.TaxBaseAmt END,
|
||||
CASE WHEN ot.IsTaxIncluded='Y' THEN NULL ELSE ot.TaxAmt END,
|
||||
null, null,
|
||||
null,null,null,null,null
|
||||
FROM C_OrderTax ot
|
||||
INNER JOIN C_Tax_Trl t ON (ot.C_Tax_ID=t.C_Tax_ID);
|
||||
NULL, NULL,
|
||||
NULL,NULL,NULL,NULL,NULL
|
||||
FROM C_ORDERTAX ot
|
||||
INNER JOIN C_TAX_TRL t ON (ot.C_Tax_ID=t.C_Tax_ID);
|
||||
|
||||
|
||||
|
||||
|
@ -474,7 +474,7 @@ CREATE OR REPLACE VIEW M_INOUT_LINE_V
|
|||
C_PROJECTPHASE_ID, C_PROJECTTASK_ID)
|
||||
AS
|
||||
SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy, iol.Updated, iol.UpdatedBy,
|
||||
'en_US' AS AD_Language,
|
||||
'en_US' AS AD_LANGUAGE,
|
||||
iol.M_InOut_ID, iol.M_InOutLine_ID,
|
||||
iol.Line, p.M_Product_ID,
|
||||
CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN iol.MovementQty END AS MovementQty,
|
||||
|
@ -482,24 +482,24 @@ SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy
|
|||
CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol,
|
||||
ol.QtyOrdered, ol.QtyDelivered,
|
||||
CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN ol.QtyOrdered-ol.QtyDelivered END AS QtyBackOrdered,
|
||||
COALESCE(p.Name||productAttribute(iol.M_AttributeSetInstance_ID), c.Name, iol.Description) AS Name, -- main line
|
||||
CASE WHEN COALESCE(c.Name,p.Name) IS NOT NULL THEN iol.Description END AS Description, -- second line
|
||||
COALESCE(p.NAME||Productattribute(iol.M_AttributeSetInstance_ID), c.NAME, iol.Description) AS NAME, -- main line
|
||||
CASE WHEN COALESCE(c.NAME,p.NAME) IS NOT NULL THEN iol.Description END AS Description, -- second line
|
||||
p.DocumentNote, -- third line
|
||||
p.UPC, p.SKU, p.Value AS ProductValue,
|
||||
p.UPC, p.SKU, p.VALUE AS ProductValue,
|
||||
iol.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z,
|
||||
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_InOutLine iol
|
||||
FROM M_INOUTLINE iol
|
||||
INNER JOIN C_UOM uom ON (iol.C_UOM_ID=uom.C_UOM_ID)
|
||||
LEFT OUTER JOIN M_Product p ON (iol.M_Product_ID=p.M_Product_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)
|
||||
LEFT OUTER JOIN C_OrderLine ol ON (iol.C_OrderLine_ID=ol.C_OrderLine_ID)
|
||||
LEFT OUTER JOIN C_Charge c ON (iol.C_Charge_ID=c.C_Charge_ID)
|
||||
LEFT OUTER JOIN M_PRODUCT p ON (iol.M_Product_ID=p.M_Product_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)
|
||||
LEFT OUTER JOIN C_ORDERLINE ol ON (iol.C_OrderLine_ID=ol.C_OrderLine_ID)
|
||||
LEFT OUTER JOIN C_CHARGE c ON (iol.C_Charge_ID=c.C_Charge_ID)
|
||||
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,
|
||||
'en_US' AS AD_LANGUAGE,
|
||||
iol.M_InOut_ID, iol.M_InOutLine_ID,
|
||||
iol.Line+(bl.Line/100) AS Line, p.M_Product_ID,
|
||||
--iol.MovementQty*b.BOMQty AS QtyInvoiced,
|
||||
|
@ -507,11 +507,11 @@ SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy
|
|||
--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
|
||||
NULL, NULL, NULL,
|
||||
p.NAME, -- main line
|
||||
b.Description, -- second line
|
||||
p.DocumentNote, -- third line
|
||||
p.UPC, p.SKU, p.Value AS ProductValue,
|
||||
p.UPC, p.SKU, p.VALUE AS ProductValue,
|
||||
iol.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z,
|
||||
iol.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate,
|
||||
p.Description AS ProductDescription, p.ImageURL,
|
||||
|
@ -523,17 +523,16 @@ SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy
|
|||
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 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
|
||||
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 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);
|
||||
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);
|
||||
|
||||
|
||||
|
||||
|
@ -549,7 +548,7 @@ CREATE OR REPLACE VIEW M_INOUT_LINE_VT
|
|||
C_PROJECTPHASE_ID, C_PROJECTTASK_ID)
|
||||
AS
|
||||
SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy, iol.Updated, iol.UpdatedBy,
|
||||
uom.AD_Language,
|
||||
uom.AD_LANGUAGE,
|
||||
iol.M_InOut_ID, iol.M_InOutLine_ID,
|
||||
iol.Line, p.M_Product_ID,
|
||||
CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN iol.MovementQty END AS MovementQty,
|
||||
|
@ -557,25 +556,25 @@ SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy
|
|||
CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN uom.UOMSymbol END AS UOMSymbol,
|
||||
ol.QtyOrdered, ol.QtyDelivered,
|
||||
CASE WHEN iol.MovementQty<>0 OR iol.M_Product_ID IS NOT NULL THEN ol.QtyOrdered-ol.QtyDelivered END AS QtyBackOrdered,
|
||||
COALESCE(COALESCE(pt.Name,p.Name)||productAttribute(iol.M_AttributeSetInstance_ID), c.Name, iol.Description) AS Name, -- main line
|
||||
CASE WHEN COALESCE(pt.Name,p.Name,c.Name) IS NOT NULL THEN iol.Description END AS Description, -- second line
|
||||
COALESCE(COALESCE(pt.NAME,p.NAME)||Productattribute(iol.M_AttributeSetInstance_ID), c.NAME, iol.Description) AS NAME, -- main line
|
||||
CASE WHEN COALESCE(pt.NAME,p.NAME,c.NAME) IS NOT NULL THEN iol.Description END AS Description, -- second line
|
||||
COALESCE(pt.DocumentNote, p.DocumentNote) AS DocumentNote, -- third line
|
||||
p.UPC, p.SKU, p.Value AS ProductValue,
|
||||
p.UPC, p.SKU, p.VALUE AS ProductValue,
|
||||
iol.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z,
|
||||
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_InOutLine iol
|
||||
INNER JOIN C_UOM_Trl uom ON (iol.C_UOM_ID=uom.C_UOM_ID)
|
||||
LEFT OUTER JOIN M_Product p ON (iol.M_Product_ID=p.M_Product_ID)
|
||||
LEFT OUTER 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)
|
||||
LEFT OUTER JOIN C_OrderLine ol ON (iol.C_OrderLine_ID=ol.C_OrderLine_ID)
|
||||
LEFT OUTER JOIN C_Charge c ON (iol.C_Charge_ID=c.C_Charge_ID)
|
||||
FROM M_INOUTLINE iol
|
||||
INNER JOIN C_UOM_TRL uom ON (iol.C_UOM_ID=uom.C_UOM_ID)
|
||||
LEFT OUTER JOIN M_PRODUCT p ON (iol.M_Product_ID=p.M_Product_ID)
|
||||
LEFT OUTER 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)
|
||||
LEFT OUTER JOIN C_ORDERLINE ol ON (iol.C_OrderLine_ID=ol.C_OrderLine_ID)
|
||||
LEFT OUTER JOIN C_CHARGE c ON (iol.C_Charge_ID=c.C_Charge_ID)
|
||||
UNION
|
||||
SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy, iol.Updated, iol.UpdatedBy,
|
||||
uom.AD_Language,
|
||||
uom.AD_LANGUAGE,
|
||||
iol.M_InOut_ID, iol.M_InOutLine_ID,
|
||||
iol.Line+(bl.Line/100) AS Line, p.M_Product_ID,
|
||||
--iol.MovementQty*b.BOMQty AS QtyInvoiced,
|
||||
|
@ -583,11 +582,11 @@ SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy
|
|||
--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
|
||||
NULL, NULL, NULL,
|
||||
COALESCE (pt.NAME, p.NAME) AS NAME, -- main line
|
||||
b.Description, -- second line
|
||||
COALESCE (pt.DocumentNote, p.DocumentNote) AS DocumentNote, -- third line
|
||||
p.UPC, p.SKU, p.Value AS ProductValue,
|
||||
p.UPC, p.SKU, p.VALUE AS ProductValue,
|
||||
iol.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z,
|
||||
iol.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,asi.GuaranteeDate,
|
||||
pt.Description AS ProductDescription, p.ImageURL,
|
||||
|
@ -601,16 +600,16 @@ SELECT iol.AD_Client_ID, iol.AD_Org_ID, iol.IsActive, iol.Created, iol.CreatedBy
|
|||
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
|
||||
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);
|
||||
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);
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue