Update ddlutils view definition from last migration script
This commit is contained in:
parent
035445f5f1
commit
1738aedbcc
|
@ -1,18 +1,18 @@
|
||||||
CREATE OR REPLACE VIEW M_PRODUCT_SUBSTITUTERELATED_V AS
|
CREATE OR REPLACE VIEW M_Product_SubstituteRelated_V AS
|
||||||
SELECT s.AD_Client_ID, s.AD_Org_ID, s.IsActive, s.Created, s.CreatedBy, s.Updated, s.UpdatedBy, s.m_product_id, s.substitute_id, s.description, 'S' AS ROWTYPE, (ms.qtyonhand - ms.qtyreserved) AS qtyavailable, ms.qtyonhand, ms.qtyreserved, mpr.pricestd, mpr.m_pricelist_version_id, mw.m_warehouse_id
|
SELECT s.AD_Client_ID, s.AD_Org_ID, s.IsActive, s.Created, s.CreatedBy, s.Updated, s.UpdatedBy, s.m_product_id, s.substitute_id, s.description, 'S' AS ROWTYPE, (ms.qtyonhand - ms.qtyreserved) AS qtyavailable, ms.qtyonhand, ms.qtyreserved, mpr.pricestd, mpr.m_pricelist_version_id, mw.m_warehouse_id, mp.NAME, org.NAME AS orgname
|
||||||
FROM M_SUBSTITUTE s
|
FROM M_SUBSTITUTE s
|
||||||
JOIN M_STORAGE ms ON ms.m_product_id = s.substitute_id
|
JOIN M_STORAGE ms ON ms.m_product_id = s.substitute_id
|
||||||
JOIN M_PRODUCT mp ON ms.m_product_id = mp.m_product_id
|
JOIN M_PRODUCT mp ON ms.m_product_id = mp.m_product_id
|
||||||
JOIN M_LOCATOR ml ON ms.m_locator_id = ml.m_locator_id
|
JOIN M_LOCATOR ml ON ms.m_locator_id = ml.m_locator_id
|
||||||
JOIN M_WAREHOUSE mw ON ml.m_warehouse_id = mw.m_warehouse_id
|
JOIN M_WAREHOUSE mw ON ml.m_warehouse_id = mw.m_warehouse_id
|
||||||
JOIN M_PRODUCTPRICE mpr ON ms.m_product_id = mpr.m_product_id
|
JOIN M_PRODUCTPRICE mpr ON ms.m_product_id = mpr.m_product_id
|
||||||
|
JOIN AD_ORG org ON org.ad_org_id = mw.ad_org_id
|
||||||
UNION
|
UNION
|
||||||
SELECT r.ad_client_id, r.ad_org_id, r.IsActive, r.Created, r.CreatedBy, r.Updated, r.UpdatedBy, r.m_product_id, r.relatedproduct_id, r.description, 'R' AS ROWTYPE, (ms.qtyonhand - ms.qtyreserved) AS qtyavailable, ms.qtyonhand, ms.qtyreserved, mpr.pricestd, mpr.m_pricelist_version_id, mw.m_warehouse_id
|
SELECT r.ad_client_id, r.ad_org_id, r.IsActive, r.Created, r.CreatedBy, r.Updated, r.UpdatedBy, r.m_product_id, r.relatedproduct_id, r.description, 'R' AS ROWTYPE, (ms.qtyonhand - ms.qtyreserved) AS qtyavailable, ms.qtyonhand, ms.qtyreserved, mpr.pricestd, mpr.m_pricelist_version_id, mw.m_warehouse_id, mp.NAME, org.NAME AS orgname
|
||||||
FROM M_RELATEDPRODUCT r
|
FROM M_RELATEDPRODUCT r
|
||||||
JOIN M_STORAGE ms ON ms.m_product_id = r.relatedproduct_id
|
JOIN M_STORAGE ms ON ms.m_product_id = r.relatedproduct_id
|
||||||
JOIN M_PRODUCT mp ON ms.m_product_id = mp.m_product_id
|
JOIN M_PRODUCT mp ON ms.m_product_id = mp.m_product_id
|
||||||
JOIN M_LOCATOR ml ON ms.m_locator_id = ml.m_locator_id
|
JOIN M_LOCATOR ml ON ms.m_locator_id = ml.m_locator_id
|
||||||
JOIN M_WAREHOUSE mw ON ml.m_warehouse_id = mw.m_warehouse_id
|
JOIN M_WAREHOUSE mw ON ml.m_warehouse_id = mw.m_warehouse_id
|
||||||
JOIN M_PRODUCTPRICE mpr ON ms.m_product_id = mpr.m_product_id;
|
JOIN M_PRODUCTPRICE mpr ON ms.m_product_id = mpr.m_product_id
|
||||||
|
JOIN AD_ORG org ON org.ad_org_id = mw.ad_org_id;
|
||||||
COMMIT;
|
|
|
@ -1,18 +1,55 @@
|
||||||
CREATE OR REPLACE VIEW M_PRODUCT_SUBSTITUTERELATED_V AS
|
CREATE OR
|
||||||
SELECT s.AD_Client_ID, s.AD_Org_ID, s.IsActive, s.Created, s.CreatedBy, s.Updated, s.UpdatedBy, s.m_product_id, s.substitute_id, s.description, 'S' AS ROWTYPE, (ms.qtyonhand - ms.qtyreserved) AS qtyavailable, ms.qtyonhand, ms.qtyreserved, mpr.pricestd, mpr.m_pricelist_version_id, mw.m_warehouse_id
|
REPLACE VIEW m_product_substituterelated_v AS
|
||||||
FROM M_SUBSTITUTE s
|
SELECT s.ad_client_id,
|
||||||
JOIN M_STORAGE ms ON ms.m_product_id = s.substitute_id
|
s.ad_org_id,
|
||||||
JOIN M_PRODUCT mp ON ms.m_product_id = mp.m_product_id
|
s.isactive,
|
||||||
JOIN M_LOCATOR ml ON ms.m_locator_id = ml.m_locator_id
|
s.created,
|
||||||
JOIN M_WAREHOUSE mw ON ml.m_warehouse_id = mw.m_warehouse_id
|
s.createdby,
|
||||||
JOIN M_PRODUCTPRICE mpr ON ms.m_product_id = mpr.m_product_id
|
s.updated,
|
||||||
UNION
|
s.updatedby,
|
||||||
SELECT r.ad_client_id, r.ad_org_id, r.IsActive, r.Created, r.CreatedBy, r.Updated, r.UpdatedBy, r.m_product_id, r.relatedproduct_id, r.description, 'R' AS ROWTYPE, (ms.qtyonhand - ms.qtyreserved) AS qtyavailable, ms.qtyonhand, ms.qtyreserved, mpr.pricestd, mpr.m_pricelist_version_id, mw.m_warehouse_id
|
s.m_product_id,
|
||||||
FROM M_RELATEDPRODUCT r
|
s.substitute_id,
|
||||||
JOIN M_STORAGE ms ON ms.m_product_id = r.relatedproduct_id
|
s.description,
|
||||||
JOIN M_PRODUCT mp ON ms.m_product_id = mp.m_product_id
|
'S' AS ROWTYPE,
|
||||||
JOIN M_LOCATOR ml ON ms.m_locator_id = ml.m_locator_id
|
(ms.qtyonhand - ms.qtyreserved) AS qtyavailable,
|
||||||
JOIN M_WAREHOUSE mw ON ml.m_warehouse_id = mw.m_warehouse_id
|
mp.NAME,
|
||||||
JOIN M_PRODUCTPRICE mpr ON ms.m_product_id = mpr.m_product_id;
|
ms.qtyonhand,
|
||||||
|
ms.qtyreserved,
|
||||||
COMMIT;
|
mpr.pricestd,
|
||||||
|
mpr.m_pricelist_version_id,
|
||||||
|
mw.m_warehouse_id,
|
||||||
|
org.NAME AS orgname
|
||||||
|
FROM M_SUBSTITUTE s
|
||||||
|
JOIN M_STORAGE ms ON ms.m_product_id = s.substitute_id
|
||||||
|
JOIN M_PRODUCT mp ON ms.m_product_id = mp.m_product_id
|
||||||
|
JOIN M_LOCATOR ml ON ms.m_locator_id = ml.m_locator_id
|
||||||
|
JOIN M_WAREHOUSE mw ON ml.m_warehouse_id = mw.m_warehouse_id
|
||||||
|
JOIN M_PRODUCTPRICE mpr ON ms.m_product_id = mpr.m_product_id
|
||||||
|
JOIN AD_ORG org ON org.ad_org_id = mw.ad_org_id
|
||||||
|
UNION
|
||||||
|
SELECT r.ad_client_id,
|
||||||
|
r.ad_org_id,
|
||||||
|
r.isactive,
|
||||||
|
r.created,
|
||||||
|
r.createdby,
|
||||||
|
r.updated,
|
||||||
|
r.updatedby,
|
||||||
|
r.m_product_id,
|
||||||
|
r.relatedproduct_id AS substitute_id,
|
||||||
|
r.description,
|
||||||
|
'R' AS ROWTYPE,
|
||||||
|
(ms.qtyonhand - ms.qtyreserved) AS qtyavailable,
|
||||||
|
mp.NAME,
|
||||||
|
ms.qtyonhand,
|
||||||
|
ms.qtyreserved,
|
||||||
|
mpr.pricestd,
|
||||||
|
mpr.m_pricelist_version_id,
|
||||||
|
mw.m_warehouse_id,
|
||||||
|
org.NAME AS orgname
|
||||||
|
FROM M_RELATEDPRODUCT r
|
||||||
|
JOIN M_STORAGE ms ON ms.m_product_id = r.relatedproduct_id
|
||||||
|
JOIN M_PRODUCT mp ON ms.m_product_id = mp.m_product_id
|
||||||
|
JOIN M_LOCATOR ml ON ms.m_locator_id = ml.m_locator_id
|
||||||
|
JOIN M_WAREHOUSE mw ON ml.m_warehouse_id = mw.m_warehouse_id
|
||||||
|
JOIN M_PRODUCTPRICE mpr ON ms.m_product_id = mpr.m_product_id
|
||||||
|
JOIN AD_ORG org ON org.ad_org_id = mw.ad_org_id;
|
Loading…
Reference in New Issue