Hi All,
I am currently preparing a dashboard report in which I am matching the balance with the Standard Stock Status Report. However, I am encountering a variance of 250 in cost, even though the quantity matches correctly.
Could anyone please assist me in identifying which transaction type I might be calculating incorrectly?
Your help will be greatly appreciated.
This is my cost Calculation …
CASE
-- Positive Transaction Types
WHEN PartTran.TranType IN ('ADJ-QTY', 'DMR-STK', 'INS-STK', 'MFG-STK', 'PLT-STK', 'PUR-STK', 'SVG-STK') THEN PartTran.ExtCost
WHEN PartTran.TranType = 'ADJ-CST' AND PartTran.InventoryTrans = 1 THEN PartTran.ExtCost
WHEN PartTran.TranType = 'ADJ-CUS' AND PartTran.InventoryTrans = 0 THEN 0 - PartTran.ExtCost
WHEN PartTran.TranType = 'STK-ASM' THEN (0 - PartTran.ExtCost)
WHEN PartTran.TranType = 'STK-AST' THEN (0 - PartTran.ExtCost)
WHEN PartTran.TranType = 'STK-CUS' THEN (0 - PartTran.ExtCost)
WHEN PartTran.TranType = 'STK-INS' THEN (0 - PartTran.ExtCost)
WHEN PartTran.TranType = 'STK-KIT' THEN (0 - PartTran.ExtCost)
WHEN PartTran.TranType = 'STK-MTL' THEN (0 - PartTran.ExtCost)
WHEN PartTran.TranType = 'STK-PLT' THEN (0 - PartTran.ExtCost)
WHEN PartTran.TranType = 'STK-UKN' THEN (0 - PartTran.ExtCost)
-- Positive quantities for specific types
WHEN PartTran.TranType IN ('ADJ-QTY', 'DMR-STK', 'INS-STK', 'MFG-STK', 'PLT-STK', 'PUR-STK', 'INS-MTL', 'PUR-UKN', 'STK-STK', 'SVG-STK')
AND PartTran.TranQty > 0 THEN PartTran.ExtCost
WHEN PartTran.TranType = 'ADJ-CST' AND PartTran.TranQty > 0 AND PartTran.InventoryTrans = 1 THEN PartTran.ExtCost
WHEN PartTran.TranType = 'ADJ-CUS' AND PartTran.TranQty > 0 AND PartTran.InventoryTrans = 0 THEN 0 - PartTran.ExtCost
-- Negative quantities for specific types
WHEN PartTran.TranType IN ('STK-ASM', 'STK-AST', 'STK-CUS', 'STK-INS', 'STK-KIT', 'STK-MTL', 'STK-PLT', 'STK-UKN')
AND PartTran.TranQty < 0 THEN (0 - PartTran.ExtCost)
WHEN PartTran.TranType IN ('ADJ-QTY', 'INS-STK', 'MFG-STK', 'PLT-STK', 'PUR-STK', 'STK-STK', 'SVG-STK')
AND PartTran.TranQty < 0 THEN PartTran.ExtCost
WHEN PartTran.TranType = 'ADJ-CST' AND PartTran.TranQty < 0 AND PartTran.InventoryTrans = 1 THEN PartTran.ExtCost
WHEN PartTran.TranType = 'ADJ-CUS' AND PartTran.TranQty < 0 AND PartTran.InventoryTrans = 0 THEN 0 - PartTran.ExtCost
-- Special conditions for 'INS-MTL' and 'PUR-UKN'
WHEN PartTran.TranType = 'INS-MTL' AND PartTran.TranQty > 0 THEN 0
WHEN PartTran.TranType = 'PUR-UKN' AND PartTran.TranQty > 0 THEN 0
-- Adjustments for 'ADJ-PUR' where InventoryTrans = 1
WHEN PartTran.TranType = 'ADJ-PUR' AND PartTran.InventoryTrans = 1 THEN PartTran.ExtCost
-- Default case
ELSE 0
END