Operation Details
Description:  
Sterotype: nsmulti
SQL
SELECT
  ServiceAuthorizationLineItem.serviceAuthorizationLIID,
  ServiceAuthorizationLineItem.serviceAuthorizationID,
  ServiceAuthorizationLineItem.dateAdded,
  ServiceAuthorizationLineItem.fromDate,
  ServiceAuthorizationLineItem.toDate,
  ServiceAuthorizationLineItem.unitsAuthorized,
  ServiceAuthorizationLineItem.unitAmount,
  ServiceAuthorizationLineItem.unitAmountFixedInd,
  ServiceAuthorizationLineItem.totalCost,
  ServiceAuthorizationLineItem.maximumUnits,
  ServiceAuthorizationLineItem.maximumUnitsFrequency,
  ServiceAuthorizationLineItem.providerID,
  ServiceAuthorizationLineItem.serviceID,
  ServiceAuthorizationLineItem.recordStatus,
  ServiceAuthorizationLineItem.nomineeID,
  ServiceAuthorizationLineItem.providerType
INTO
  :serviceAuthorizationLIID,
  :serviceAuthorizationID,
  :dateAdded,
  :fromDate,
  :toDate,
  :unitsAuthorized,
  :unitAmount,
  :unitAmountFixedInd,
  :totalCost,
  :maximumUnits,
  :maximumUnitsFrequency,
  :providerID,
  :serviceID,
  :recordStatus,
  :nomineeID,
  :providerType 
FROM
  SERVICEAUTHORIZATION,
  SERVICEAUTHORIZATIONLINEITEM 
WHERE SERVICEAUTHORIZATION.caseparticipantroleid = :caseParticipantRoleID 
  AND SERVICEAUTHORIZATION.serviceauthorizationid = SERVICEAUTHORIZATIONLINEITEM.serviceauthorizationid 
  AND SERVICEAUTHORIZATIONLINEITEM.serviceid = :serviceID 
  AND SERVICEAUTHORIZATIONLINEITEM.recordstatus = :status 
  AND 
  (
    
    (
      ServiceAuthorizationLineItem.fromDate >= :fromDate 
      AND ServiceAuthorizationLineItem.toDate <= :toDate
    ) 
    OR 
    (
      ServiceAuthorizationLineItem.fromDate <= :fromDate 
      AND ServiceAuthorizationLineItem.toDate >= :toDate
    ) 
    OR 
    (
      ServiceAuthorizationLineItem.fromDate <= :fromDate 
      AND ServiceAuthorizationLineItem.toDate <= :toDate 
      AND ServiceAuthorizationLineItem.toDate >= :fromDate
    ) 
    OR 
    (
      ServiceAuthorizationLineItem.fromDate >= :fromDate 
      AND ServiceAuthorizationLineItem.toDate >= :toDate 
      AND ServiceAuthorizationLineItem.fromDate < = :toDate
    )
  )