From a8a91a7e1d8af14cf1a1e657297972693f99b156 Mon Sep 17 00:00:00 2001 From: mjudd Date: Mon, 1 Feb 2010 21:41:57 +0000 Subject: [PATCH] [ BF 2944056 ] - Fix quantities for Substitute & Related products in InfoProduct https://sourceforge.net/tracker/index.php?func=detail&aid=2944056&group_id=176962&atid=879332 Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2944056 --- ...944056_FixSubstituteRelatedInfoProduct.sql | 28 +++++++++++++++++++ ...944056_FixSubstituteRelatedInfoProduct.sql | 28 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 migration/354a-trunk/oracle/660_BF_2944056_FixSubstituteRelatedInfoProduct.sql create mode 100644 migration/354a-trunk/postgresql/660_BF_2944056_FixSubstituteRelatedInfoProduct.sql diff --git a/migration/354a-trunk/oracle/660_BF_2944056_FixSubstituteRelatedInfoProduct.sql b/migration/354a-trunk/oracle/660_BF_2944056_FixSubstituteRelatedInfoProduct.sql new file mode 100644 index 0000000000..716e559f45 --- /dev/null +++ b/migration/354a-trunk/oracle/660_BF_2944056_FixSubstituteRelatedInfoProduct.sql @@ -0,0 +1,28 @@ +--- BF 2944056 https://sourceforge.net/tracker/?func=detail&aid=2944056&group_id=176962&atid=879332 +--- Fix Related and Substitute Inventory Quantity in the InfoProduct window + +DROP VIEW M_PRODUCT_SUBSTITUTERELATED_V; + +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' AS rowtype, mp.name, sum(ms.qtyonhand - ms.qtyreserved) AS qtyavailable, sum(ms.qtyonhand) AS qtyonhand, sum(ms.qtyreserved) AS qtyreserved, +ROUND(MAX(mpr.pricestd),0) AS 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 + GROUP BY 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, mw.m_warehouse_id, mpr.m_pricelist_version_id, org.name, mp.name +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' AS rowtype, mp.name, sum(ms.qtyonhand - ms.qtyreserved) AS qtyavailable, sum(ms.qtyonhand) AS qtyonhand, sum(ms.qtyreserved) AS qtyreserved, round(MAX(mpr.pricestd),0) AS 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 + GROUP BY 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, mw.m_warehouse_id, mpr.m_pricelist_version_id, org.name, mp.name; \ No newline at end of file diff --git a/migration/354a-trunk/postgresql/660_BF_2944056_FixSubstituteRelatedInfoProduct.sql b/migration/354a-trunk/postgresql/660_BF_2944056_FixSubstituteRelatedInfoProduct.sql new file mode 100644 index 0000000000..eae9fb4b15 --- /dev/null +++ b/migration/354a-trunk/postgresql/660_BF_2944056_FixSubstituteRelatedInfoProduct.sql @@ -0,0 +1,28 @@ +--- BF 2944056 https://sourceforge.net/tracker/?func=detail&aid=2944056&group_id=176962&atid=879332 +--- Fix Related and Substitute Inventory Quantity in the InfoProduct window + +DROP VIEW M_PRODUCT_SUBSTITUTERELATED_V; + +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' AS rowtype, mp.name, sum(ms.qtyonhand - ms.qtyreserved) AS qtyavailable, sum(ms.qtyonhand) AS qtyonhand, sum(ms.qtyreserved) AS qtyreserved, +ROUND(MAX(mpr.pricestd),0) AS 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 + GROUP BY 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, mw.m_warehouse_id, mpr.m_pricelist_version_id, org.name, mp.name +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' AS rowtype, mp.name, sum(ms.qtyonhand - ms.qtyreserved) AS qtyavailable, sum(ms.qtyonhand) AS qtyonhand, sum(ms.qtyreserved) AS qtyreserved, round(MAX(mpr.pricestd),0) AS 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 + GROUP BY 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, mw.m_warehouse_id, mpr.m_pricelist_version_id, org.name, mp.name; \ No newline at end of file