Database SQL Operation: InstructionLineItem.readLatestCoverPeriodToForCaseAndListObjective
Description: | Retrieves the latest cover period to date for a specified case and list objective (list objectives are distinguished using the related reference), based on ILI records with a status of 'Processed', 'Unprocessed', 'Cancelled', 'Expired' and Transferred. |
Sterotype: | ns |
SELECT
MAX (coverPeriodTo)
INTO
:coverPeriodTo
FROM
InstructionLineItem,
CaseDecisionFinancialComp,
CaseDecisionObjective
WHERE InstructionLineItem.caseID = :caseID
AND InstructionLineItem.statusCode IN ( :statusCode, :iliStatusCodeExpired, :iliStatusCodeProcessed, :iliStatusCodeUnprocessed, :iliStatusCodeAllocated, :iliStatusCodeTransferred)
AND InstructionLineItem.financialCompID = CaseDecisionFinancialComp.financialCompID
AND CaseDecisionFinancialComp.CaseDecisionObjectiveID = CaseDecisionObjective.CaseDecisionObjectiveID
AND CaseDecisionObjective.relatedReference = :relatedReferenceOpt
AND CaseDecisionObjective.objectiveID = :rulesObjectiveID
|