7167-testToMaster_2414 #2244
|
@ -15,11 +15,8 @@ BEGIN
|
|||
* @param vMaxAlertLevel Id nivel de alerta
|
||||
* @param vWarehouseFk Id de almacén
|
||||
*/
|
||||
DECLARE vMidnight DATETIME DEFAULT util.dayEnd(vDated);
|
||||
DECLARE vEndingDate DATETIME DEFAULT vMidnight + INTERVAL vScopeDays DAY;
|
||||
DECLARE vEndingDate DATETIME DEFAULT util.dayEnd(vDated) + INTERVAL vScopeDays DAY;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tConfectionControlSource
|
||||
ENGINE = MEMORY
|
||||
SELECT t.shipped,
|
||||
t.id ticketFk,
|
||||
s.id saleFk,
|
||||
|
@ -73,27 +70,24 @@ BEGIN
|
|||
AND tls.alertLevel < vMaxAlertLevel
|
||||
AND wh.hasConfectionTeam
|
||||
AND t.shipped BETWEEN vDated AND vEndingDate
|
||||
AND s.quantity > 0;
|
||||
|
||||
-- Entradas
|
||||
INSERT INTO tConfectionControlSource(
|
||||
shipped,
|
||||
ticketFk,
|
||||
quantity,
|
||||
concept,
|
||||
category,
|
||||
nickname,
|
||||
warehouse,
|
||||
description
|
||||
)
|
||||
AND s.quantity > 0
|
||||
UNION ALL
|
||||
SELECT tr.shipped,
|
||||
e.id,
|
||||
NULL,
|
||||
b.quantity,
|
||||
i.name,
|
||||
NULL,
|
||||
i.category,
|
||||
NULL,
|
||||
whi.name,
|
||||
who.name,
|
||||
ct.description
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
ct.description,
|
||||
NULL,
|
||||
NULL
|
||||
FROM buy b
|
||||
JOIN `entry` e ON e.id = b.entryFk
|
||||
JOIN travel tr ON tr.id = e.travelFk
|
||||
|
@ -105,8 +99,5 @@ BEGIN
|
|||
WHERE who.hasConfectionTeam
|
||||
AND it.making
|
||||
AND tr.shipped BETWEEN vDated AND vEndingDate;
|
||||
|
||||
SELECT * FROM tConfectionControlSource;
|
||||
DROP TEMPORARY TABLE tConfectionControlSource;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
Loading…
Reference in New Issue