Operation Details
Description: Method to return all slots for specified location and date.
Sterotype: nsmulti
SQL
SELECT
  Slot.slotID,
  Slot.maxWorkUnits,
  Slot.name,
  Slot.startTime,
  Slot.endTime,
  CASE 
    WHEN numberWorkUnits IS NULL 
    THEN 0 
    ELSE numberWorkUnits 
  END
 
INTO
  :slotID,
  :maxWorkUnits,
  :slotName,
  :startTime,
  :endTime,
  :numberWorkUnits 
FROM
  Slot 
  
  LEFT OUTER JOIN
  
  
  ( 
  SELECT
    slotID AS SASlotID,
    numberWorkUnits 
  FROM
    SlotAllocation 
  WHERE SlotAllocation.slotAllocationDate = :effectiveDate 
  ) SA 
  ON Slot.slotID = SA.SASlotID,
  DailySchedule 
WHERE DailySchedule.effectiveDate = 
  ( 
  SELECT
    MAX(effectiveDate) 
  FROM
    DailySchedule 
  WHERE DailySchedule.locationID = :locationID 
    AND DailySchedule.effectiveDate <= :effectiveDate 
  ) 
  AND Slot.scheduleID = DailySchedule.scheduleID 
  AND Slot.locationID = :locationID