Cory Weiner
03/31/2023, 7:29 PMJoseph Lee
03/31/2023, 8:30 PM-- Joseph Lee
-- Main Warehouse On Hand Inventory Analysis
-- Bin, Quantities, Costs & Total Inventory On Hand Cost Sum
SELECT
*
FROM
(
SELECT
NULL AS "Item ID",
NULL AS Item_name,
NULL AS "Bin id",
NULL AS "Bin name",
NULL AS "Bin quantity",
NULL AS "Item average cost",
TO_CHAR(ROUND(SUM(item.averageCost*Onhand), 2), '$999,999,999.00') AS "Item Average Cost Per Bin",
NULL AS "warehouse zone",
NULL AS "location",
FROM
ItemBinQuantity
LEFT OUTER JOIN bin ON itemBinQuantity.bin = bin.id
LEFT OUTER JOIN item ON itemBinQuantity.item = item.id
WHERE
( item.custitem_mm_saleable_item = 'T' )
AND ( OnHand > 0 )
AND ( bin.type IN ( 'STORAGE','PICKING' ) AND ( BUILTIN.DF( bin.location ) = 'Main' ) )
UNION ALL
SELECT
Item AS "Item ID",
BUILTIN.DF( Item ) AS Item_Name,
Bin AS "Bin ID",
BUILTIN.DF( Bin ) AS "Bin Name",
OnHand AS "Bin Quantity",
TO_CHAR(item.averageCost, '$999,999,999.00') AS "Item Average cost",
TO_CHAR(item.averageCost*Onhand, '$999,999,999.00') AS "Item Average Cost Per Bin",
BUILTIN.DF( bin.custrecord_wmsse_zone ) AS "Warehouse Zone",
BUILTIN.DF( bin.location ) AS "Location"
FROM
ItemBinQuantity
LEFT OUTER JOIN bin ON itemBinQuantity.bin = bin.id
LEFT OUTER JOIN item on itemBinQuantity.item = item.id
WHERE
( item.custitem_mm_saleable_item = 'T' )
AND ( OnHand > 0 )
AND ( bin.type IN ( 'STORAGE','PICKING' ) AND ( BUILTIN.DF( bin.location ) = 'Main' ) )
)
ORDER BY
item_name
Joseph Lee
03/31/2023, 8:31 PMCory Weiner
03/31/2023, 9:34 PM