pears.GetShiftLength
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
Original SQL
CREATE FUNCTION "pears"."GetShiftLength"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ IN @TimeFrom TIME,IN @TimeTo TIME, IN @BreakMinutes SMALLINT DEFAULT 0 ) RETURNS DOUBLE BEGIN DECLARE "ShiftLength" DOUBLE; IF @TimeTo > @TimeFrom THEN SET "ShiftLength" = (CAST("datediff"("minute",@TimeFrom,@TimeTo) AS DOUBLE)-"isnull"(@BreakMinutes,0))/60.0 ELSE SET "ShiftLength" = (CAST("datediff"("minute",@TimeFrom,'00:00:00') AS DOUBLE)+1440.0+CAST("datediff"("minute",'00:00:00',@TimeTo) AS DOUBLE)-"isnull"(@BreakMinutes,0))/60.0 END IF; RETURN "ShiftLength" END