Operation Details
Description: Returns a count of all unapproved and all submitted planned items for a service plan.
Sterotype: ns
SQL
SELECT
  COUNT(*)
INTO
  :recordCount 
FROM
  PlannedGoal,
  PlannedSubGoal,
  PlannedItem 
WHERE PlannedGoal.caseID = :caseID 
  AND PlannedSubGoal.plannedGoalID = PlannedGoal.plannedGoalID 
  AND PlannedItem.plannedSubGoalID = PlannedSubGoal.plannedSubGoalID 
  AND 
  (
    PlannedItem.status = :planItemStatusUnapproved 
    OR PlannedItem.status = :planItemStatusSubmitted 
  )