901: AND WO.STATUS_CODE NOT IN ( '17' , '22' )
902: /* to check whether visit available in client's organization */
903: AND WO.visit_id = VS.visit_id
904: AND VS.ORGANIZATION_ID IN
905: (SELECT ORGANIZATION_ID FROM org_organization_definitions
906: WHERE NVL (operating_unit, mo_global.get_current_org_id())
907: = mo_global.get_current_org_id())
908: AND VST.visit_id = VS.visit_id
909: /* */