SELECT conv.setid , conv.inv_item_id , lt.config_code , conv.unit_of_measure , lt.business_unit , %Round(%DecMult(SUM(pi.qty_base - pi.qty_reserved_base), (%DecDiv(1,conv.conversion_rate))), 4) FROM ps_set_cntrl_rec sc , ps_physical_inv pi , PS_LOT_CONTROL_INV lt , ps_inv_item_uom conv WHERE sc.setcntrlvalue = lt.business_unit AND sc.recname = 'MASTER_ITEM_TBL' AND conv.setid = sc.setid AND lt.business_unit = pi.business_unit AND lt.inv_item_id = pi.inv_item_id AND lt.inv_item_id = conv.inv_item_id AND lt.inv_lot_id = pi.inv_lot_id AND EXISTS( SELECT 'X' FROM ps_stor_loc_inv lc WHERE %Join(COMMON_KEYS, STOR_LOC_INV LC, PHYSICAL_INV PI) AND lc.nettable_flg = 'Y' AND lc.suspend_flg = 'N' AND lc.phys_cyc_inv_flg = 'N' AND lc.wip_loc_flg = 'N') GROUP BY conv.setid, conv.inv_item_id, lt.config_code, conv.unit_of_measure, lt.business_unit, conv.conversion_rate
|