feat: refs #8139 Added if is campaign #3206
|
@ -75,16 +75,11 @@ BEGIN
|
||||||
|
|
||||||
SET vDated = DATE(vTimed);
|
SET vDated = DATE(vTimed);
|
||||||
|
|
||||||
SELECT EXISTS (
|
|
||||||
SELECT TRUE FROM campaign
|
|
||||||
WHERE vTimed BETWEEN dated - INTERVAL scopeDays DAY AND dated
|
|
||||||
) INTO vIsCampaing;
|
|
||||||
|
|
||||||
SELECT IF(pc.code = 'driverCE',
|
SELECT IF(pc.code = 'driverCE',
|
||||||
wc.dayBreakDriver,
|
wc.dayBreakDriver,
|
||||||
wc.dayBreak),
|
wc.dayBreak),
|
||||||
wc.shortWeekBreak,
|
wc.shortWeekBreak,
|
||||||
IF(vIsCampaing, NULL, wc.longWeekBreak),
|
wc.longWeekBreak,
|
||||||
wc.weekScope,
|
wc.weekScope,
|
||||||
wc.dayMaxTime,
|
wc.dayMaxTime,
|
||||||
wc.maxWorkShortCycle,
|
wc.maxWorkShortCycle,
|
||||||
|
@ -244,6 +239,11 @@ BEGIN
|
||||||
CALL util.throw(vErrorCode);
|
CALL util.throw(vErrorCode);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
SELECT EXISTS (
|
||||||
|
SELECT id FROM campaign
|
||||||
|
WHERE vTimed BETWEEN dated - INTERVAL scopeDays DAY AND dated
|
||||||
|
) INTO vIsCampaing;
|
||||||
|
|
||||||
-- VERIFICA DESCANSO SEMANAL
|
-- VERIFICA DESCANSO SEMANAL
|
||||||
WITH wtc AS(
|
WITH wtc AS(
|
||||||
(SELECT timed
|
(SELECT timed
|
||||||
|
@ -262,7 +262,7 @@ BEGIN
|
||||||
), wtcBreak AS(
|
), wtcBreak AS(
|
||||||
SELECT timed,
|
SELECT timed,
|
||||||
IF(IFNULL(gap, 0) > vShortWeekBreak, TRUE, FALSE) hasShortBreak,
|
IF(IFNULL(gap, 0) > vShortWeekBreak, TRUE, FALSE) hasShortBreak,
|
||||||
IF(IFNULL(gap, 0) > vLongWeekBreak, TRUE, FALSE) hasLongBreak
|
IF(IFNULL(gap, 0) > vLongWeekBreak AND NOT vIsCampaing, TRUE, FALSE) hasLongBreak
|
||||||
FROM wtcGap
|
FROM wtcGap
|
||||||
ORDER BY timed
|
ORDER BY timed
|
||||||
), wtcBreakCounter AS(
|
), wtcBreakCounter AS(
|
||||||
|
|
Loading…
Reference in New Issue