Operation Details
Description: Returns user job tasks due in the next time period.
Sterotype: nsmulti
SQL
SELECT
  w.deadlineTime,
  t.reservedBy
INTO
  :deadlineDateTime,
  :reservedBy 
FROM
  Task t ,
  WorkflowDeadline w 
WHERE t.taskID = w.taskID 
  AND w.deadlineTime >= :fromDeadlineDateTime 
  AND w.deadlineTime < :toDeadlineDateTime 
  AND t.taskID IN 
  ( 
  SELECT
    taskID 
  FROM
    TaskAssignment ta 
  WHERE ta.assigneeType = :assigneeType 
    AND ta.relatedID IN 
    ( 
    SELECT
      DISTINCT j.jobID 
    FROM
      Users u,
      PositionHolderLink ph,
      Position p,
      OrgUnitPositionLink oup ,
      Job j 
    WHERE u.userName = :relatedName 
      AND u.userName = ph.userName 
      AND ph.positionID = p.positionID 
      AND p.positionID = oup.positionID 
      AND j.jobID =p.jobID 
      AND ph.recordStatus = :recordStatus 
      AND :currentDate >= ph.fromDate 
      AND 
      (
        :currentDate <= ph.toDate 
        OR ph.toDate IS NULL 
      ) 
    ) 
  ) 
ORDER BY deadlineTime