Operation Details
Description: Searches for all service authorization line items for a particular service by given date range and status.
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
  ServiceAuthorizationLineItem,
  Provider 
WHERE ServiceAuthorizationLineItem.serviceID = :serviceID 
  AND ServiceAuthorizationLineItem.recordStatus = :saliRecordStatus 
  AND Provider.providerConcernRoleID = ServiceAuthorizationLineItem.providerID 
  AND Provider.recordStatus = :providerRecordStatus 
  AND 
  (
    
    (
      ServiceAuthorizationLineItem.fromDate >= :fromDate 
      AND ServiceAuthorizationLineItem.toDate <= :toDate
    ) 
    OR 
    (
      ServiceAuthorizationLineItem.fromDate <= :fromDate 
      AND ServiceAuthorizationLineItem.toDate >= :toDate
    ) 
    OR 
    (
      ServiceAuthorizationLineItem.fromDate <= :fromDate 
      AND ServiceAuthorizationLineItem.toDate >= :fromDate
    ) 
    OR 
    (
      ServiceAuthorizationLineItem.fromDate <= :toDate 
      AND ServiceAuthorizationLineItem.toDate >= :toDate
    )
  )