How to check for all lines in Order CLOSED to fetch Contract ID
Hello,
I have a scenario where for an Order if all lines gets CLOSED then the Contract ID should be fetched based on the request ID passed:
But as per the below query the query is getting fetched even some of the service lines are not CLOSED
SELECT
DISTINCT okl.dnz_chr_id header_id
FROM apps.OKC_K_HEADERS_ALL_B okc, apps.OKC_K_LINES_B okl
WHERE
okl .request_id = :p_request_id
AND okc.id = okl.dnz_chr_id
AND okl.STS_CODE IN ('SIGNED', 'ACTIVE')
AND okl.dnz_chr_id IN
(SELECT contract_id
FROM apps.oks_reprocessing