pears.wtd_start_of_hol_year

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"."wtd_start_of_hol_year" IS 
{CREATE FUNCTION wtd_start_of_hol_year 
 
/* Application Maintained Function / Procedure - DO NOT EDIT*/
 
(IN pid CHAR(20),IN yr INTEGER,IN wk INTEGER)
RETURNS DATE
BEGIN
  DECLARE sdate DATE;
  DECLARE wedate DATE;
  SET wedate="date"(weekenddate(yr,wk));
  IF wedate IS NULL THEN -- Off the range of known weeks
    RETURN NULL
  END IF
  ;
  SELECT MIN(startdate) INTO sdate FROM pay_employment WHERE personid=pid
    AND(enddate IS NULL OR enddate>=wedate-13); --(still working or stopped >= last week)
  IF sdate IS NULL THEN
    RETURN NULL
  END IF
  ;
  SET sdate=getholidayyear(sdate,wedate-7); --Does 1/10/1998 threshold, and rolls forward if > 1 year ago
  RETURN sdate
END
}
  • database/procedures/pears_wtd_start_of_hol_year.txt
  • Last modified: 2026/08/07 19:24
  • by 127.0.0.1