pears.PersonAvailableAtTime

Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.

COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."PersonAvailableAtTime" IS 
{CREATE FUNCTION PersonAvailableAtTime 
 
/* Application Maintained Function / Procedure - DO NOT EDIT*/
 
(IN sPersonid CHAR(20),IN dShiftDate DATE,IN tShiftFrom TIME,IN tShiftTo TIME,IN iCheckExplicitlyAvailable SMALLINT)
RETURNS CHAR(1)
BEGIN
  DECLARE foundState CHAR(1);
  SET foundstate=NULL; -- If we return null, we have found no explicit unavailability or availability
  -- First check for all day unavailability
  SELECT FIRST state INTO foundstate FROM tempshift WHERE state NOT IN( 'A','C') AND
    personid = spersonid AND shiftdate = dshiftdate AND(timefrom IS NULL OR timeto IS NULL);
  IF foundstate IS NULL THEN -- Look for non-concurrent employments
    SELECT FIRST 'W' INTO foundstate FROM employment WHERE
      isnull(concurrent,0) = 0 AND personid = spersonid AND startdate <= dshiftdate AND(leavedate IS NULL OR leavedate >= dshiftdate)
  END IF;
  IF foundstate IS NULL THEN
    SET foundstate=personavailableforplaniterate(spersonid,dshiftdate,tshiftfrom,tshiftto,icheckexplicitlyavailable,'')
  END IF;
  RETURN foundstate
END
}
  • database/procedures/pears_personavailableattime.txt
  • Last modified: 2026/08/07 19:24
  • by 127.0.0.1