7863-devToTest_2434 #2852
|
@ -18,9 +18,6 @@ BEGIN
|
||||||
DECLARE vSalesPersonFK INT;
|
DECLARE vSalesPersonFK INT;
|
||||||
DECLARE vItemPicker INT;
|
DECLARE vItemPicker INT;
|
||||||
DECLARE vTicketfailed INT;
|
DECLARE vTicketfailed INT;
|
||||||
DECLARE vSubjectsTicketfailed VARCHAR(50);
|
|
||||||
DECLARE vMessagesTicketfailed TEXT;
|
|
||||||
|
|
||||||
|
|
||||||
DECLARE rsTicket CURSOR FOR
|
DECLARE rsTicket CURSOR FOR
|
||||||
SELECT tt.ticketFk,
|
SELECT tt.ticketFk,
|
||||||
|
@ -221,36 +218,6 @@ BEGIN
|
||||||
END LOOP;
|
END LOOP;
|
||||||
CLOSE rsTicket;
|
CLOSE rsTicket;
|
||||||
|
|
||||||
WITH tOrigin AS (
|
|
||||||
SELECT tt.ticketFk,
|
|
||||||
t.clientFk,
|
|
||||||
t.warehouseFk,
|
|
||||||
t.companyFk,
|
|
||||||
t.addressFk,
|
|
||||||
tt.agencyModeFk,
|
|
||||||
ti.dated
|
|
||||||
FROM ticketWeekly tt
|
|
||||||
JOIN ticket t ON tt.ticketFk = t.id
|
|
||||||
JOIN tmp.time ti
|
|
||||||
WHERE WEEKDAY(ti.dated) = tt.weekDay
|
|
||||||
),total AS(
|
|
||||||
SELECT tor.ticketFk, tc.id
|
|
||||||
FROM tOrigin tor
|
|
||||||
JOIN sale so ON tor.ticketFk = so.ticketFk
|
|
||||||
LEFT JOIN ticket tc ON tc.id = tor.ticketFk
|
|
||||||
AND DATE(tc.shipped) = tor.dated
|
|
||||||
LEFT JOIN sale sc ON sc.ticketFk = tc.id
|
|
||||||
WHERE sc.id IS NULL
|
|
||||||
GROUP BY tor.ticketFk, tc.id
|
|
||||||
)SELECT COUNT(DISTINCT ticketFk) INTO vTicketfailed
|
|
||||||
FROM total;
|
|
||||||
|
|
||||||
IF vTicketfailed THEN
|
|
||||||
SET vSubjectsTicketfailed = 'Turnos - Tickets que no se han clonado ';
|
|
||||||
SET vMessagesTicketfailed = 'No se ha podido clonar tickets revisar que tickets han sido y mirar por que no se han clonado';
|
|
||||||
CALL mail_insert('nocontestar@verdnatura.es', NULL, vSubjectsTicketfailed, vMessagesTicketfailed);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.time, tmp.zoneGetLanded;
|
DROP TEMPORARY TABLE IF EXISTS tmp.time, tmp.zoneGetLanded;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
Loading…
Reference in New Issue