Stck Report
SELECT
M_PRODUCT_CATEGORY.NAME AS CATEGORYNAME,
M_PRODUCT.VALUE||'-'||M_PRODUCT.NAME AS NAME,
SUM(MOVEMENTQTY) AS MOVEMENTQTY,
M_LOCATOR.X,
M_LOCATOR.Y,
AD_COLUMN_IDENTIFIER('M_WAREHOUSE', to_char(M_LOCATOR.M_WAREHOUSE_ID), :1) AS WAREHOUSE,
M_LOCATOR.Z, C1.NAME AS UOMMOVEMENTQTY,
M_ATTRIBUTESETINSTANCE.M_ATTRIBUTESETINSTANCE_ID,
M_ATTRIBUTESETINSTANCE.DESCRIPTION,
(CASE WHEN M_TRANSACTION.M_PRODUCT_UOM_ID IS NULL THEN (CASE M_PRODUCT.WEIGHT*SUM(M_TRANSACTION.MOVEMENTQTY)
WHEN 0 THEN NULL ELSE M_PRODUCT.WEIGHT*SUM(M_TRANSACTION.MOVEMENTQTY) END) ELSE SUM(M_TRANSACTION.QUANTITYORDER) END ) AS WEIGHT,
(CASE WHEN M_TRANSACTION.M_PRODUCT_UOM_ID IS NULL THEN (CASE WHEN M_PRODUCT.WEIGHT = 0 THEN '' WHEN M_PRODUCT.WEIGHT IS NULL THEN '' ELSE 'Kgs' END) ELSE TO_CHAR(C2.NAME) END) AS UOMWEIGHT,
'' as id
FROM M_PRODUCT
left join M_PRODUCT_CATEGORY on M_PRODUCT.M_PRODUCT_CATEGORY_ID = M_PRODUCT_CATEGORY.M_PRODUCT_CATEGORY_ID,
M_PRODUCT_UOM
right join M_TRANSACTION on M_TRANSACTION.M_PRODUCT_UOM_ID = M_PRODUCT_UOM.M_PRODUCT_UOM_ID
left join C_UOM C2 on M_PRODUCT_UOM.C_UOM_ID = C2.C_UOM_ID,
M_LOCATOR, C_UOM C1,
M_ATTRIBUTESETINSTANCE
WHERE M_TRANSACTION.M_PRODUCT_ID = M_PRODUCT.M_PRODUCT_ID
AND M_TRANSACTION.M_ATTRIBUTESETINSTANCE_ID = M_ATTRIBUTESETINSTANCE.M_ATTRIBUTESETINSTANCE_ID
AND M_TRANSACTION.M_LOCATOR_ID = M_LOCATOR.M_LOCATOR_ID
AND M_TRANSACTION.C_UOM_ID = C1.C_UOM_ID
AND M_TRANSACTION.AD_CLIENT_ID IN (0,1000000) AND M_TRANSACTION.AD_ORG_ID IN (0,1000000) AND 1=1
AND M_TRANSACTION.MOVEMENTDATE <> 0
ORDER BY M_PRODUCT_CATEGORY.NAME,M_PRODUCT.VALUE, M_PRODUCT.NAME, M_ATTRIBUTESETINSTANCE.DESCRIPTION,M_LOCATOR.X, M_LOCATOR.Y,
M_LOCATOR.ZSELECT M_PRODUCT_CATEGORY.NAME AS CATEGORYNAME, M_PRODUCT.VALUE||'-'||M_PRODUCT.NAME AS NAME,
SUM(MOVEMENTQTY) AS MOVEMENTQTY,
M_LOCATOR.X, M_LOCATOR.Y,
AD_COLUMN_IDENTIFIER('M_WAREHOUSE', to_char(M_LOCATOR.M_WAREHOUSE_ID), :1) AS WAREHOUSE,
M_LOCATOR.Z, C1.NAME AS UOMMOVEMENTQTY,
M_ATTRIBUTESETINSTANCE.M_ATTRIBUTESETINSTANCE_ID,
M_ATTRIBUTESETINSTANCE.DESCRIPTION,
(CASE WHEN M_TRANSACTION.M_PRODUCT_UOM_ID IS NULL THEN (CASE M_PRODUCT.WEIGHT*SUM(M_TRANSACTION.MOVEMENTQTY)
WHEN 0 THEN NULL ELSE M_PRODUCT.WEIGHT*SUM(M_TRANSACTION.MOVEMENTQTY) END) ELSE SUM(M_TRANSACTION.QUANTITYORDER) END) AS WEIGHT,
(CASE WHEN M_TRANSACTION.M_PRODUCT_UOM_ID IS NULL THEN (CASE WHEN M_PRODUCT.WEIGHT = 0 THEN '' WHEN M_PRODUCT.WEIGHT IS NULL THEN '' ELSE 'Kgs' END) ELSE TO_CHAR(C2.NAME) END) AS UOMWEIGHT, '' as id
FROM M_PRODUCT
left join M_PRODUCT_CATEGORY on M_PRODUCT.M_PRODUCT_CATEGORY_ID = M_PRODUCT_CATEGORY.M_PRODUCT_CATEGORY_ID,
M_PRODUCT_UOM
right join M_TRANSACTION on M_TRANSACTION.M_PRODUCT_UOM_ID = M_PRODUCT_UOM.M_PRODUCT_UOM_ID
left join C_UOM C2 on M_PRODUCT_UOM.C_UOM_ID = C2.C_UOM_ID,
M_LOCATOR, C_UOM C1,
M_ATTRIBUTESETINSTANCE
WHERE M_TRANSACTION.M_PRODUCT_ID = M_PRODUCT.M_PRODUCT_ID
AND M_TRANSACTION.M_ATTRIBUTESETINSTANCE_ID = M_ATTRIBUTESETINSTANCE.M_ATTRIBUTESETINSTANCE_ID
AND M_TRANSACTION.M_LOCATOR_ID = M_LOCATOR.M_LOCATOR_ID
AND M_TRANSACTION.C_UOM_ID = C1.C_UOM_ID
AND M_TRANSACTION.AD_CLIENT_ID IN (0,1000000) AND M_TRANSACTION.AD_ORG_ID IN (0,1000000) AND 1=1
AND M_TRANSACTION.MOVEMENTDATE <> 0
ORDER BY M_PRODUCT_CATEGORY.NAME,M_PRODUCT.VALUE, M_PRODUCT.NAME, M_ATTRIBUTESETINSTANCE.DESCRIPTION,M_LOCATOR.X, M_LOCATOR.Y, M_LOCATOR.Z