Show pageOld revisionsBacklinksExport to PDFFold/unfold allBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== pears.PersonAvailableAtTime ====== <WRAP center round info> Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. </WRAP> ===== Original SQL ===== <code sql> create function "pears"."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 </code> database/functions/pears_personavailableattime.txt Last modified: 2026/08/07 19:24by 127.0.0.1