Operation Details
Description: Reads the CaseDeductionItem entity on relatedCaseID and relatedComponentID. Gets the caseReference from CaseHeader.
Sterotype: nsmulti
SQL
SELECT
  CaseDeductionItem.caseDeductionItemID,
  CaseDeductionItem.concernRoleID,
  CaseDeductionItem.createdDate,
  CaseDeductionItem.startDate,
  CaseDeductionItem.endDate,
  CaseDeductionItem.statusCode,
  CaseDeductionItem.comments,
  CaseDeductionItem.relatedCaseID,
  CaseDeductionItem.caseID,
  CaseDeductionItem.rate,
  CaseDeductionItem.amount,
  CaseDeductionItem.deductionType,
  CaseDeductionItem.relatedObjectiveID,
  CaseDeductionItem.rulesObjectiveID,
  CaseDeductionItem.versionNo,
  CaseHeader.caseReference
INTO
  :caseDeductionItemID,
  :concernRoleID,
  :createdDate,
  :startDate,
  :endDate,
  :statusCode,
  :comments,
  :relatedCaseID,
  :caseID,
  :rate,
  :amount,
  :deductionType,
  :relatedObjectiveID,
  :rulesObjectiveID,
  :versionNo,
  :caseReference 
FROM
  CaseDeductionItem,
  CaseHeader 
WHERE CaseDeductionItem.relatedCaseID = CaseHeader.caseID 
  AND CaseDeductionItem.relatedCaseID = :relatedCaseID 
  AND CaseDeductionItem.relatedObjectiveID = :relatedObjectiveID 
  AND CaseDeductionItem.statusCode = :statusCode 
  AND 
  (
    
    (
      CaseDeductionItem.startDate <= :currentDate 
      AND CaseDeductionItem.endDate IS NULL 
    ) 
    OR 
    (
      CaseDeductionItem.endDate > :currentDate 
    ) 
  )