From 56239fb0ae320f5402e94ccc391dae549945dc9b Mon Sep 17 00:00:00 2001 From: vpj-cd Date: Wed, 5 Dec 2007 23:12:22 +0000 Subject: [PATCH] adding new view to product information --- .../oracle/views/M_PRODUCT_STOCK_V.sql | 13 +++++++++++++ .../views/M_PRODUCT_SUBSTITUTERELATED_V.sql | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 db/ddlutils/oracle/views/M_PRODUCT_STOCK_V.sql create mode 100644 db/ddlutils/oracle/views/M_PRODUCT_SUBSTITUTERELATED_V.sql diff --git a/db/ddlutils/oracle/views/M_PRODUCT_STOCK_V.sql b/db/ddlutils/oracle/views/M_PRODUCT_STOCK_V.sql new file mode 100644 index 0000000000..b5ca5bff5b --- /dev/null +++ b/db/ddlutils/oracle/views/M_PRODUCT_STOCK_V.sql @@ -0,0 +1,13 @@ +--create views +CREATE OR REPLACE VIEW M_PRODUCT_STOCK_V +AS +SELECT +ms.AD_Client_ID, ms.AD_Org_ID, ms.IsActive, ms.Created, ms.CreatedBy, ms.Updated, ms.UpdatedBy, +mp.value, mp.help, (ms.qtyonhand - ms.qtyreserved) AS qtyavailable, ms.qtyonhand, +ms.qtyreserved, mp.description, mw.name as warehouse, mw.m_warehouse_id, mw.ad_client_id, +mw.ad_org_id, mp.documentnote +FROM m_storage ms +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 +ORDER BY mw.name; \ No newline at end of file diff --git a/db/ddlutils/oracle/views/M_PRODUCT_SUBSTITUTERELATED_V.sql b/db/ddlutils/oracle/views/M_PRODUCT_SUBSTITUTERELATED_V.sql new file mode 100644 index 0000000000..b2ebafa75d --- /dev/null +++ b/db/ddlutils/oracle/views/M_PRODUCT_SUBSTITUTERELATED_V.sql @@ -0,0 +1,19 @@ +CREATE OR REPLACE VIEW M_PRODUCT_SUBSTITUTERELATE_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 +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 +UNION +SELECT r.ad_client_id, r.ad_org_id, 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 +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; + +COMMIT; \ No newline at end of file