2997 - Export production
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
4f2c21707f
commit
46bbe07c3f
|
@ -1,4 +0,0 @@
|
|||
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
|
||||
VALUES
|
||||
('SupplierAddress', '*', '*', 'ALLOW', 'ROLE', 'employee'),
|
||||
('SalesMonitor', '*', '*', 'ALLOW', 'ROLE', 'employee');
|
|
@ -1 +0,0 @@
|
|||
INSERT INTO salix.module (code) VALUES ('Monitors');
|
|
@ -1,3 +0,0 @@
|
|||
UPDATE salix.ACL
|
||||
SET principalId = "salesAssistant"
|
||||
WHERE model = 'Client' AND property = 'createReceipt';
|
|
@ -1,18 +0,0 @@
|
|||
CREATE TABLE `vn`.`supplierAddress`
|
||||
(
|
||||
id INT NULL AUTO_INCREMENT,
|
||||
supplierFk INT NULL,
|
||||
nickname VARCHAR(40) NULL,
|
||||
street VARCHAR(255) NULL,
|
||||
provinceFk SMALLINT(6) UNSIGNED NULL,
|
||||
postalCode VARCHAR(10) NULL,
|
||||
city VARCHAR(50) NULL,
|
||||
phone VARCHAR(15) NULL,
|
||||
mobile VARCHAR(15) NULL,
|
||||
CONSTRAINT supplierAddress_pk
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT supplierAddress_province_fk
|
||||
FOREIGN KEY (provinceFk) REFERENCES province (id)
|
||||
ON UPDATE CASCADE
|
||||
);
|
||||
|
|
@ -1,193 +0,0 @@
|
|||
DROP PROCEDURE IF EXISTS `vn`.`sale_getProblems`;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE
|
||||
DEFINER = root@`%` PROCEDURE `vn`.`sale_getProblems`(IN vIsTodayRelative TINYINT(1))
|
||||
BEGIN
|
||||
/**
|
||||
* Calcula los problemas de cada venta
|
||||
* para un conjunto de tickets.
|
||||
*
|
||||
* @table tmp.sale_getProblems(ticketFk, clientFk, warehouseFk, shipped) Identificadores de los tickets a calcular
|
||||
* @return tmp.sale_problems
|
||||
*/
|
||||
DECLARE vWarehouse INT;
|
||||
DECLARE vDate DATE;
|
||||
DECLARE vAvailableCache INT;
|
||||
DECLARE vDone INT DEFAULT 0;
|
||||
DECLARE vComponentCount INT;
|
||||
|
||||
DECLARE vCursor CURSOR FOR
|
||||
SELECT DISTINCT tt.warehouseFk, IF(vIsTodayRelative, CURDATE(), date(tt.shipped))
|
||||
FROM tmp.sale_getProblems tt
|
||||
WHERE DATE(tt.shipped) BETWEEN CURDATE()
|
||||
AND TIMESTAMPADD(DAY, IF(vIsTodayRelative, 9.9, 1.9), CURDATE());
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale_problems;
|
||||
CREATE TEMPORARY TABLE tmp.sale_problems (
|
||||
ticketFk INT(11),
|
||||
saleFk INT(11),
|
||||
isFreezed INTEGER(1) DEFAULT 0,
|
||||
risk DECIMAL(10,2) DEFAULT 0,
|
||||
hasTicketRequest INTEGER(1) DEFAULT 0,
|
||||
isAvailable INTEGER(1) DEFAULT 1,
|
||||
itemShortage VARCHAR(250),
|
||||
isTaxDataChecked INTEGER(1) DEFAULT 1,
|
||||
itemDelay VARCHAR(250),
|
||||
hasComponentLack INTEGER(1),
|
||||
PRIMARY KEY (ticketFk, saleFk)
|
||||
) ENGINE = MEMORY;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list;
|
||||
CREATE TEMPORARY TABLE tmp.ticket_list
|
||||
(PRIMARY KEY (ticketFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT tp.ticketFk, c.id clientFk
|
||||
FROM tmp.sale_getProblems tp
|
||||
JOIN vn.client c ON c.id = tp.clientFk;
|
||||
|
||||
SELECT COUNT(*) INTO vComponentCount
|
||||
FROM vn.component c
|
||||
WHERE c.isRequired;
|
||||
|
||||
INSERT INTO tmp.sale_problems(ticketFk, hasComponentLack, saleFk)
|
||||
SELECT tl.ticketFk, (COUNT(DISTINCT s.id) * vComponentCount > COUNT(c.id)), s.id
|
||||
FROM tmp.ticket_list tl
|
||||
JOIN vn.sale s ON s.ticketFk = tl.ticketFk
|
||||
LEFT JOIN vn.saleComponent sc ON sc.saleFk = s.id
|
||||
LEFT JOIN vn.component c ON c.id = sc.componentFk AND c.isRequired
|
||||
GROUP BY tl.ticketFk, s.id;
|
||||
|
||||
INSERT INTO tmp.sale_problems(ticketFk, isFreezed)
|
||||
SELECT DISTINCT tl.ticketFk, TRUE
|
||||
FROM tmp.ticket_list tl
|
||||
JOIN vn.client c ON c.id = tl.clientFk
|
||||
WHERE c.isFreezed
|
||||
ON DUPLICATE KEY UPDATE
|
||||
isFreezed = c.isFreezed;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt;
|
||||
CREATE TEMPORARY TABLE tmp.clientGetDebt
|
||||
(PRIMARY KEY (clientFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT DISTINCT clientFk
|
||||
FROM tmp.ticket_list;
|
||||
|
||||
CALL clientGetDebt(CURDATE());
|
||||
|
||||
INSERT INTO tmp.sale_problems(ticketFk, risk)
|
||||
SELECT DISTINCT tl.ticketFk, r.risk
|
||||
FROM tmp.ticket_list tl
|
||||
JOIN vn.ticket t ON t.id = tl.ticketFk
|
||||
JOIN vn.agencyMode a ON t.agencyModeFk = a.id
|
||||
JOIN tmp.risk r ON r.clientFk = t.clientFk
|
||||
JOIN vn.client c ON c.id = t.clientFk
|
||||
JOIN vn.clientConfig cc
|
||||
WHERE r.risk - cc.riskTolerance > c.credit + 10
|
||||
AND a.isRiskFree = FALSE
|
||||
ON DUPLICATE KEY UPDATE
|
||||
risk = r.risk;
|
||||
|
||||
INSERT INTO tmp.sale_problems(ticketFk, hasTicketRequest)
|
||||
SELECT DISTINCT tl.ticketFk, TRUE
|
||||
FROM tmp.ticket_list tl
|
||||
JOIN vn.ticketRequest tr ON tr.ticketFk = tl.ticketFk
|
||||
WHERE tr.isOK IS NULL
|
||||
ON DUPLICATE KEY UPDATE
|
||||
hasTicketRequest = TRUE;
|
||||
|
||||
OPEN vCursor;
|
||||
|
||||
WHILE NOT vDone
|
||||
DO
|
||||
FETCH vCursor INTO vWarehouse, vDate;
|
||||
|
||||
CALL cache.available_refresh(vAvailableCache, FALSE, vWarehouse, vDate);
|
||||
|
||||
INSERT INTO tmp.sale_problems(ticketFk, isAvailable, saleFk)
|
||||
SELECT tl.ticketFk, FALSE, s.id
|
||||
FROM tmp.ticket_list tl
|
||||
JOIN vn.ticket t ON t.id = tl.ticketFk
|
||||
JOIN vn.sale s ON s.ticketFk = t.id
|
||||
JOIN vn.item i ON i.id = s.itemFk
|
||||
JOIN vn.itemType it on it.id = i.typeFk
|
||||
LEFT JOIN cache.available av ON av.item_id = i.id
|
||||
AND av.calc_id = vAvailableCache
|
||||
WHERE date(t.shipped) = vDate
|
||||
AND it.categoryFk != 6
|
||||
AND IFNULL(av.available, 0) < 0
|
||||
AND s.isPicked = FALSE
|
||||
AND NOT i.generic
|
||||
AND vWarehouse = t.warehouseFk
|
||||
GROUP BY tl.ticketFk
|
||||
ON DUPLICATE KEY UPDATE
|
||||
isAvailable = FALSE, saleFk = VALUE(saleFk);
|
||||
|
||||
INSERT INTO tmp.sale_problems(ticketFk, itemShortage, saleFk)
|
||||
SELECT ticketFk, problem, saleFk
|
||||
FROM (
|
||||
SELECT tl.ticketFk, CONCAT('F: ',GROUP_CONCAT(i.id, ' ', i.longName, ' ')) problem, s.id AS saleFk
|
||||
FROM tmp.ticket_list tl
|
||||
JOIN vn.ticket t ON t.id = tl.ticketFk
|
||||
JOIN vn.sale s ON s.ticketFk = t.id
|
||||
JOIN vn.item i ON i.id = s.itemFk
|
||||
JOIN vn.itemType it on it.id = i.typeFk
|
||||
LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk
|
||||
LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache
|
||||
WHERE IFNULL(av.available, 0) < 0
|
||||
AND s.quantity > IFNULL(issw.visible, 0)
|
||||
AND s.quantity > 0
|
||||
AND s.isPicked = FALSE
|
||||
AND s.reserved = FALSE
|
||||
AND it.categoryFk != 6
|
||||
AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate)
|
||||
AND NOT i.generic
|
||||
AND CURDATE() = vDate
|
||||
AND t.warehouseFk = vWarehouse
|
||||
GROUP BY tl.ticketFk LIMIT 1) sub
|
||||
ON DUPLICATE KEY UPDATE
|
||||
itemShortage = sub.problem, saleFk = sub.saleFk;
|
||||
|
||||
INSERT INTO tmp.sale_problems(ticketFk, itemDelay, saleFk)
|
||||
SELECT ticketFk, problem, saleFk
|
||||
FROM (
|
||||
SELECT tl.ticketFk, GROUP_CONCAT('I: ',i.id, ' ', i.longName, ' ') problem, s.id AS saleFk
|
||||
FROM tmp.ticket_list tl
|
||||
JOIN vn.ticket t ON t.id = tl.ticketFk
|
||||
JOIN vn.sale s ON s.ticketFk = t.id
|
||||
JOIN vn.item i ON i.id = s.itemFk
|
||||
JOIN vn.itemType it on it.id = i.typeFk
|
||||
LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk
|
||||
WHERE s.quantity > IFNULL(issw.visible, 0)
|
||||
AND s.quantity > 0
|
||||
AND s.isPicked = FALSE
|
||||
AND s.reserved = FALSE
|
||||
AND it.categoryFk != 6
|
||||
AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate)
|
||||
AND NOT i.generic
|
||||
AND CURDATE() = vDate
|
||||
AND t.warehouseFk = vWarehouse
|
||||
GROUP BY tl.ticketFk LIMIT 1) sub
|
||||
ON DUPLICATE KEY UPDATE
|
||||
itemDelay = sub.problem, saleFk = sub.saleFk;
|
||||
END WHILE;
|
||||
|
||||
CLOSE vCursor;
|
||||
|
||||
INSERT INTO tmp.sale_problems(ticketFk, isTaxDataChecked)
|
||||
SELECT DISTINCT tl.ticketFk, FALSE
|
||||
FROM tmp.ticket_list tl
|
||||
JOIN vn.client c ON c.id = tl.clientFk
|
||||
WHERE c.isTaxDataChecked = FALSE
|
||||
ON DUPLICATE KEY UPDATE
|
||||
isTaxDataChecked = FALSE;
|
||||
|
||||
DROP TEMPORARY TABLE
|
||||
tmp.clientGetDebt,
|
||||
tmp.ticket_list;
|
||||
END;;$$
|
||||
DELIMITER ;
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
DROP PROCEDURE IF EXISTS `vn`.`sale_getProblemsByTicket`;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE
|
||||
DEFINER = root@`%` PROCEDURE `vn`.`sale_getProblemsByTicket`(IN vTicketFk INT, IN vIsTodayRelative TINYINT(1))
|
||||
BEGIN
|
||||
/**
|
||||
* Calcula los problemas de cada venta
|
||||
* para un conjunto de tickets.
|
||||
*
|
||||
* @return Problems result
|
||||
*/
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale_getProblems;
|
||||
CREATE TEMPORARY TABLE tmp.sale_getProblems
|
||||
(INDEX (ticketFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT t.id ticketFk, t.clientFk, t.warehouseFk, t.shipped
|
||||
FROM ticket t
|
||||
WHERE t.id = vTicketFk;
|
||||
|
||||
CALL sale_getProblems(vIsTodayRelative);
|
||||
|
||||
SELECT * FROM tmp.sale_problems;
|
||||
|
||||
DROP TEMPORARY TABLE
|
||||
tmp.sale_getProblems,
|
||||
tmp.sale_problems;
|
||||
END;;$$
|
||||
DELIMITER ;
|
|
@ -1,187 +0,0 @@
|
|||
DROP PROCEDURE IF EXISTS `vn`.`ticketGetProblems`;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE
|
||||
DEFINER = root@`%` PROCEDURE `vn`.`ticketGetProblems`(IN vIsTodayRelative TINYINT(1))
|
||||
BEGIN
|
||||
/**
|
||||
* @deprecated Use ticket_getProblems() instead
|
||||
*
|
||||
*/
|
||||
DECLARE vWarehouse INT;
|
||||
DECLARE vDate DATE;
|
||||
DECLARE vAvailableCache INT;
|
||||
DECLARE vDone INT DEFAULT 0;
|
||||
DECLARE vComponentCount INT;
|
||||
|
||||
DECLARE vCursor CURSOR FOR
|
||||
SELECT DISTINCT tt.warehouseFk, IF(vIsTodayRelative, CURDATE(), date(tt.shipped))
|
||||
FROM tmp.ticketGetProblems tt
|
||||
WHERE DATE(tt.shipped) BETWEEN CURDATE()
|
||||
AND TIMESTAMPADD(DAY, IF(vIsTodayRelative, 9.9, 1.9), CURDATE());
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketProblems;
|
||||
CREATE TEMPORARY TABLE tmp.ticketProblems (
|
||||
ticketFk INT(11) PRIMARY KEY,
|
||||
isFreezed INTEGER(1) DEFAULT 0,
|
||||
risk DECIMAL(10,2) DEFAULT 0,
|
||||
hasTicketRequest INTEGER(1) DEFAULT 0,
|
||||
isAvailable INTEGER(1) DEFAULT 1,
|
||||
itemShortage VARCHAR(250),
|
||||
isTaxDataChecked INTEGER(1) DEFAULT 1,
|
||||
itemDelay VARCHAR(250),
|
||||
componentLack INTEGER(1)
|
||||
) ENGINE = MEMORY;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketList;
|
||||
CREATE TEMPORARY TABLE tmp.ticketList
|
||||
(PRIMARY KEY (ticketFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT tp.ticketFk, c.id clientFk
|
||||
FROM tmp.ticketGetProblems tp
|
||||
JOIN vn.client c ON c.id = tp.clientFk;
|
||||
|
||||
SELECT COUNT(*) INTO vComponentCount
|
||||
FROM vn.component c
|
||||
WHERE c.isRequired;
|
||||
|
||||
INSERT INTO tmp.ticketProblems(ticketFk, componentLack)
|
||||
SELECT tl.ticketFk, (COUNT(DISTINCT s.id) * vComponentCount > COUNT(c.id))
|
||||
FROM tmp.ticketList tl
|
||||
JOIN vn.sale s ON s.ticketFk = tl.ticketFk
|
||||
LEFT JOIN vn.saleComponent sc ON sc.saleFk = s.id
|
||||
LEFT JOIN vn.component c ON c.id = sc.componentFk AND c.isRequired
|
||||
GROUP BY tl.ticketFk;
|
||||
|
||||
INSERT INTO tmp.ticketProblems(ticketFk, isFreezed)
|
||||
SELECT DISTINCT tl.ticketFk, 1
|
||||
FROM tmp.ticketList tl
|
||||
JOIN vn.client c ON c.id = tl.clientFk
|
||||
WHERE c.isFreezed
|
||||
ON DUPLICATE KEY UPDATE
|
||||
isFreezed = c.isFreezed;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt;
|
||||
CREATE TEMPORARY TABLE tmp.clientGetDebt
|
||||
(PRIMARY KEY (clientFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT DISTINCT clientFk
|
||||
FROM tmp.ticketList;
|
||||
|
||||
CALL clientGetDebt(CURDATE());
|
||||
|
||||
INSERT INTO tmp.ticketProblems(ticketFk, risk)
|
||||
SELECT DISTINCT tl.ticketFk, r.risk
|
||||
FROM tmp.ticketList tl
|
||||
JOIN vn.ticket t ON t.id = tl.ticketFk
|
||||
JOIN vn.agencyMode a ON t.agencyModeFk = a.id
|
||||
JOIN tmp.risk r ON r.clientFk = t.clientFk
|
||||
JOIN vn.client c ON c.id = t.clientFk
|
||||
JOIN vn.clientConfig cc
|
||||
WHERE r.risk - cc.riskTolerance > c.credit + 10
|
||||
AND a.isRiskFree = FALSE
|
||||
ON DUPLICATE KEY UPDATE
|
||||
risk = r.risk;
|
||||
|
||||
INSERT INTO tmp.ticketProblems(ticketFk, hasTicketRequest)
|
||||
SELECT DISTINCT tl.ticketFk, 1
|
||||
FROM tmp.ticketList tl
|
||||
JOIN vn.ticketRequest tr ON tr.ticketFk = tl.ticketFk
|
||||
WHERE tr.isOK IS NULL AND tr.saleFk IS NOT NULL
|
||||
ON DUPLICATE KEY UPDATE
|
||||
hasTicketRequest = 1;
|
||||
|
||||
OPEN vCursor;
|
||||
|
||||
WHILE NOT vDone
|
||||
DO
|
||||
FETCH vCursor INTO vWarehouse, vDate;
|
||||
|
||||
CALL cache.available_refresh(vAvailableCache, FALSE, vWarehouse, vDate);
|
||||
|
||||
INSERT INTO tmp.ticketProblems(ticketFk, isAvailable)
|
||||
SELECT tl.ticketFk, 0
|
||||
FROM tmp.ticketList tl
|
||||
JOIN vn.ticket t ON t.id = tl.ticketFk
|
||||
JOIN vn.sale s ON s.ticketFk = t.id
|
||||
JOIN vn.item i ON i.id = s.itemFk
|
||||
JOIN vn.itemType it on it.id = i.typeFk
|
||||
LEFT JOIN cache.available av ON av.item_id = i.id
|
||||
AND av.calc_id = vAvailableCache
|
||||
WHERE date(t.shipped) = vDate
|
||||
AND it.categoryFk != 6
|
||||
AND IFNULL(av.available, 0) < 0
|
||||
AND s.isPicked = FALSE
|
||||
AND NOT i.generic
|
||||
AND vWarehouse = t.warehouseFk
|
||||
GROUP BY tl.ticketFk
|
||||
ON DUPLICATE KEY UPDATE
|
||||
isAvailable = 0;
|
||||
|
||||
INSERT INTO tmp.ticketProblems(ticketFk, itemShortage)
|
||||
SELECT ticketFk, problem
|
||||
FROM (
|
||||
SELECT tl.ticketFk, CONCAT('F: ',GROUP_CONCAT(i.id, ' ', i.longName, ' ')) problem
|
||||
FROM tmp.ticketList tl
|
||||
JOIN vn.ticket t ON t.id = tl.ticketFk
|
||||
JOIN vn.sale s ON s.ticketFk = t.id
|
||||
JOIN vn.item i ON i.id = s.itemFk
|
||||
JOIN vn.itemType it on it.id = i.typeFk
|
||||
LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk
|
||||
LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache
|
||||
WHERE IFNULL(av.available, 0) < 0
|
||||
AND s.quantity > IFNULL(issw.visible, 0)
|
||||
AND s.quantity > 0
|
||||
AND s.isPicked = FALSE
|
||||
AND s.reserved = FALSE
|
||||
AND it.categoryFk != 6
|
||||
AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate)
|
||||
AND NOT i.generic
|
||||
AND CURDATE() = vDate
|
||||
AND t.warehouseFk = vWarehouse
|
||||
GROUP BY tl.ticketFk) sub
|
||||
ON DUPLICATE KEY UPDATE
|
||||
itemShortage = sub.problem;
|
||||
|
||||
INSERT INTO tmp.ticketProblems(ticketFk, itemDelay)
|
||||
SELECT ticketFk, problem
|
||||
FROM (
|
||||
SELECT tl.ticketFk, GROUP_CONCAT('I: ',i.id, ' ', i.longName, ' ') problem
|
||||
FROM tmp.ticketList tl
|
||||
JOIN vn.ticket t ON t.id = tl.ticketFk
|
||||
JOIN vn.sale s ON s.ticketFk = t.id
|
||||
JOIN vn.item i ON i.id = s.itemFk
|
||||
JOIN vn.itemType it on it.id = i.typeFk
|
||||
LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk
|
||||
WHERE s.quantity > IFNULL(issw.visible, 0)
|
||||
AND s.quantity > 0
|
||||
AND s.isPicked = FALSE
|
||||
AND s.reserved = FALSE
|
||||
AND it.categoryFk != 6
|
||||
AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate)
|
||||
AND NOT i.generic
|
||||
AND CURDATE() = vDate
|
||||
AND t.warehouseFk = vWarehouse
|
||||
GROUP BY tl.ticketFk) sub
|
||||
ON DUPLICATE KEY UPDATE
|
||||
itemDelay = sub.problem;
|
||||
END WHILE;
|
||||
|
||||
CLOSE vCursor;
|
||||
|
||||
INSERT INTO tmp.ticketProblems(ticketFk, isTaxDataChecked)
|
||||
SELECT DISTINCT tl.ticketFk, FALSE
|
||||
FROM tmp.ticketList tl
|
||||
JOIN vn.client c ON c.id = tl.clientFk
|
||||
WHERE c.isTaxDataChecked= FALSE
|
||||
ON DUPLICATE KEY UPDATE
|
||||
isTaxDataChecked = FALSE;
|
||||
|
||||
DROP TEMPORARY TABLE
|
||||
tmp.clientGetDebt,
|
||||
tmp.ticketList;
|
||||
END;;$$
|
||||
DELIMITER ;
|
|
@ -1,92 +0,0 @@
|
|||
DROP PROCEDURE `vn`.`ticket_componentMakeUpdate`;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE
|
||||
DEFINER = root@`%` PROCEDURE `vn`.`ticket_componentMakeUpdate`(IN vTicketFk INT, IN vClientFk INT, IN vAgencyModeFk INT,
|
||||
IN vAddressFk INT, IN vZoneFk INT, IN vWarehouseFk TINYINT,
|
||||
IN vCompanyFk SMALLINT, IN vShipped DATETIME,
|
||||
IN vLanded DATE, IN vIsDeleted TINYINT(1),
|
||||
IN vHasToBeUnrouted TINYINT(1), IN vOption INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Modifica en el ticket los campos que se le pasan por parámetro
|
||||
* y cambia sus componentes.
|
||||
* Este procedimiento es transacionado en Salix
|
||||
*
|
||||
* @param vTicketFk Id del ticket a modificar
|
||||
* @param vClientFk nuevo cliente
|
||||
* @param vAgencyModeFk nueva agencia
|
||||
* @param vAddressFk nuevo consignatario
|
||||
* @param vZoneFk nueva zona
|
||||
* @param vWarehouseFk nuevo almacen
|
||||
* @param vCompanyFk nueva empresa
|
||||
* @param vShipped nueva fecha del envio de mercancia
|
||||
* @param vLanded nueva fecha de recepcion de mercancia
|
||||
* @param vIsDeleted si se borra el ticket
|
||||
* @param vHasToBeUnrouted si se le elimina la ruta al ticket
|
||||
* @param vOption opcion para el case del proc ticketComponentUpdateSale
|
||||
*/
|
||||
DECLARE vPrice DECIMAL(10,2);
|
||||
DECLARE vBonus DECIMAL(10,2);
|
||||
|
||||
CALL ticket_componentPreview (vTicketFk, vLanded, vAddressFk, vZoneFk, vWarehouseFk);
|
||||
|
||||
IF (SELECT addressFk FROM ticket WHERE id = vTicketFk) <> vAddressFk THEN
|
||||
|
||||
UPDATE ticket t
|
||||
JOIN address a ON a.id = vAddressFk
|
||||
SET t.nickname = a.nickname
|
||||
WHERE t.id = vTicketFk;
|
||||
|
||||
END IF;
|
||||
|
||||
CALL zone_getShippedWarehouse(vlanded, vAddressFk, vAgencyModeFk);
|
||||
|
||||
SELECT zoneFk, price, bonus INTO vZoneFk, vPrice, vBonus
|
||||
FROM tmp.zoneGetShipped
|
||||
WHERE shipped BETWEEN DATE(vShipped) AND util.dayEnd(vShipped) AND warehouseFk = vWarehouseFk LIMIT 1;
|
||||
|
||||
UPDATE ticket t
|
||||
SET
|
||||
t.clientFk = vClientFk,
|
||||
t.agencyModeFk = vAgencyModeFk,
|
||||
t.addressFk = vAddressFk,
|
||||
t.zoneFk = vZoneFk,
|
||||
t.zonePrice = vPrice,
|
||||
t.zoneBonus = vBonus,
|
||||
t.warehouseFk = vWarehouseFk,
|
||||
t.companyFk = vCompanyFk,
|
||||
t.landed = vLanded,
|
||||
t.shipped = vShipped,
|
||||
t.isDeleted = vIsDeleted
|
||||
WHERE
|
||||
t.id = vTicketFk;
|
||||
|
||||
IF vHasToBeUnrouted THEN
|
||||
UPDATE ticket t SET t.routeFk = NULL
|
||||
WHERE t.id = vTicketFk;
|
||||
END IF;
|
||||
|
||||
IF vOption <> 8 THEN
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
||||
CREATE TEMPORARY TABLE tmp.sale
|
||||
(PRIMARY KEY (saleFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT id AS saleFk, vWarehouseFk warehouseFk
|
||||
FROM sale s WHERE s.ticketFk = vTicketFk;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent;
|
||||
CREATE TEMPORARY TABLE tmp.ticketComponent
|
||||
SELECT * FROM tmp.ticketComponentPreview;
|
||||
|
||||
CALL ticketComponentUpdateSale (vOption);
|
||||
|
||||
DROP TEMPORARY TABLE tmp.sale;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent;
|
||||
END IF;
|
||||
|
||||
DROP TEMPORARY TABLE tmp.zoneGetShipped, tmp.ticketComponentPreview;
|
||||
END;;$$
|
||||
DELIMITER ;
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
DROP PROCEDURE IF EXISTS `vn`.`ticket_getProblems`;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE
|
||||
DEFINER = root@`%` PROCEDURE `vn`.`ticket_getProblems`(IN vIsTodayRelative TINYINT(1))
|
||||
BEGIN
|
||||
/**
|
||||
* Calcula los problemas para un conjunto de tickets.
|
||||
* Agrupados por ticket
|
||||
*
|
||||
* @table tmp.sale_getProblems(ticketFk, clientFk, warehouseFk, shipped) Identificadores de los tickets a calcular
|
||||
* @return tmp.ticket_problems
|
||||
*/
|
||||
CALL sale_getProblems(vIsTodayRelative);
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticket_problems;
|
||||
CREATE TEMPORARY TABLE tmp.ticket_problems
|
||||
(INDEX (ticketFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT
|
||||
ticketFk,
|
||||
MAX(p.isFreezed) AS isFreezed,
|
||||
MAX(p.risk) AS risk,
|
||||
MAX(p.hasTicketRequest) AS hasTicketRequest,
|
||||
MIN(p.isAvailable) AS isAvailable,
|
||||
MAX(p.itemShortage) AS itemShortage,
|
||||
MIN(p.isTaxDataChecked) AS isTaxDataChecked,
|
||||
MAX(p.hasComponentLack) AS hasComponentLack
|
||||
FROM tmp.sale_problems p
|
||||
GROUP BY ticketFk;
|
||||
|
||||
DROP TEMPORARY TABLE
|
||||
tmp.sale_problems;
|
||||
END;;$$
|
||||
DELIMITER ;
|
|
@ -1,4 +0,0 @@
|
|||
ALTER TABLE `vn`.`warehouse`
|
||||
ADD `code` VARCHAR(3) NULL AFTER name;
|
||||
|
||||
UPDATE `vn`.`warehouse` SET `code` = 'ALG' WHERE `id` = 60;
|
|
@ -1,9 +0,0 @@
|
|||
ALTER TABLE `vn`.`starredModule`
|
||||
ADD `position` INT NOT NULL AFTER `moduleFk`;
|
||||
|
||||
SET @count:=0;
|
||||
UPDATE `vn`.`starredModule` sm
|
||||
JOIN (
|
||||
SELECT sm.id, IF(@workerFk = sm.workerFk, @count:=@count+1, @count:=1) AS position, @workerFk:=sm.workerFk
|
||||
FROM `vn`.`starredModule` sm ORDER BY workerFk, moduleFk ASC) AS smt ON smt.id = sm.id
|
||||
SET sm.position = smt.position;
|
|
@ -1,18 +0,0 @@
|
|||
CREATE TABLE `vn`.`invoiceInLog` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`originFk` MEDIUMINT UNSIGNED NOT NULL,
|
||||
`userFk` int(10) unsigned DEFAULT NULL,
|
||||
`action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL,
|
||||
`creationDate` timestamp NULL DEFAULT current_timestamp(),
|
||||
`description` text CHARACTER SET utf8 DEFAULT NULL,
|
||||
`changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
`oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
`newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
`changedModelId` int(11) DEFAULT NULL,
|
||||
`changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `originFk` (`originFk`),
|
||||
KEY `userFk` (`userFk`),
|
||||
CONSTRAINT `invoiceInLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn`.`invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `invoiceInLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
|
@ -1,192 +0,0 @@
|
|||
DROP PROCEDURE IF EXISTS `vn`.`sale_getProblems`;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE
|
||||
DEFINER = root@`%` PROCEDURE `vn`.`sale_getProblems`(IN vIsTodayRelative TINYINT(1))
|
||||
BEGIN
|
||||
/**
|
||||
* Calcula los problemas de cada venta
|
||||
* para un conjunto de tickets.
|
||||
*
|
||||
* @table tmp.sale_getProblems(ticketFk, clientFk, warehouseFk, shipped) Identificadores de los tickets a calcular
|
||||
* @return tmp.sale_problems
|
||||
*/
|
||||
DECLARE vWarehouse INT;
|
||||
DECLARE vDate DATE;
|
||||
DECLARE vAvailableCache INT;
|
||||
DECLARE vDone INT DEFAULT 0;
|
||||
DECLARE vComponentCount INT;
|
||||
|
||||
DECLARE vCursor CURSOR FOR
|
||||
SELECT DISTINCT tt.warehouseFk, IF(vIsTodayRelative, CURDATE(), date(tt.shipped))
|
||||
FROM tmp.sale_getProblems tt
|
||||
WHERE DATE(tt.shipped) BETWEEN CURDATE()
|
||||
AND TIMESTAMPADD(DAY, IF(vIsTodayRelative, 9.9, 1.9), CURDATE());
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale_problems;
|
||||
CREATE TEMPORARY TABLE tmp.sale_problems (
|
||||
ticketFk INT(11),
|
||||
saleFk INT(11),
|
||||
isFreezed INTEGER(1) DEFAULT 0,
|
||||
risk DECIMAL(10,2) DEFAULT 0,
|
||||
hasTicketRequest INTEGER(1) DEFAULT 0,
|
||||
isAvailable INTEGER(1) DEFAULT 1,
|
||||
itemShortage VARCHAR(250),
|
||||
isTaxDataChecked INTEGER(1) DEFAULT 1,
|
||||
itemDelay VARCHAR(250),
|
||||
hasComponentLack INTEGER(1),
|
||||
PRIMARY KEY (ticketFk, saleFk)
|
||||
) ENGINE = MEMORY;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list;
|
||||
CREATE TEMPORARY TABLE tmp.ticket_list
|
||||
(PRIMARY KEY (ticketFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT tp.ticketFk, c.id clientFk
|
||||
FROM tmp.sale_getProblems tp
|
||||
JOIN vn.client c ON c.id = tp.clientFk;
|
||||
|
||||
SELECT COUNT(*) INTO vComponentCount
|
||||
FROM vn.component c
|
||||
WHERE c.isRequired;
|
||||
|
||||
INSERT INTO tmp.sale_problems(ticketFk, hasComponentLack, saleFk)
|
||||
SELECT tl.ticketFk, (COUNT(DISTINCT s.id) * vComponentCount > COUNT(c.id)), s.id
|
||||
FROM tmp.ticket_list tl
|
||||
JOIN vn.sale s ON s.ticketFk = tl.ticketFk
|
||||
LEFT JOIN vn.saleComponent sc ON sc.saleFk = s.id
|
||||
LEFT JOIN vn.component c ON c.id = sc.componentFk AND c.isRequired
|
||||
GROUP BY tl.ticketFk, s.id;
|
||||
|
||||
INSERT INTO tmp.sale_problems(ticketFk, isFreezed)
|
||||
SELECT DISTINCT tl.ticketFk, TRUE
|
||||
FROM tmp.ticket_list tl
|
||||
JOIN vn.client c ON c.id = tl.clientFk
|
||||
WHERE c.isFreezed
|
||||
ON DUPLICATE KEY UPDATE
|
||||
isFreezed = c.isFreezed;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt;
|
||||
CREATE TEMPORARY TABLE tmp.clientGetDebt
|
||||
(PRIMARY KEY (clientFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT DISTINCT clientFk
|
||||
FROM tmp.ticket_list;
|
||||
|
||||
CALL clientGetDebt(CURDATE());
|
||||
|
||||
INSERT INTO tmp.sale_problems(ticketFk, risk)
|
||||
SELECT DISTINCT tl.ticketFk, r.risk
|
||||
FROM tmp.ticket_list tl
|
||||
JOIN vn.ticket t ON t.id = tl.ticketFk
|
||||
JOIN vn.agencyMode a ON t.agencyModeFk = a.id
|
||||
JOIN tmp.risk r ON r.clientFk = t.clientFk
|
||||
JOIN vn.client c ON c.id = t.clientFk
|
||||
JOIN vn.clientConfig cc
|
||||
WHERE r.risk > c.credit + 10
|
||||
AND a.isRiskFree = FALSE
|
||||
ON DUPLICATE KEY UPDATE
|
||||
risk = r.risk;
|
||||
|
||||
INSERT INTO tmp.sale_problems(ticketFk, hasTicketRequest)
|
||||
SELECT DISTINCT tl.ticketFk, TRUE
|
||||
FROM tmp.ticket_list tl
|
||||
JOIN vn.ticketRequest tr ON tr.ticketFk = tl.ticketFk
|
||||
WHERE tr.isOK IS NULL
|
||||
ON DUPLICATE KEY UPDATE
|
||||
hasTicketRequest = TRUE;
|
||||
|
||||
OPEN vCursor;
|
||||
|
||||
WHILE NOT vDone
|
||||
DO
|
||||
FETCH vCursor INTO vWarehouse, vDate;
|
||||
|
||||
CALL cache.available_refresh(vAvailableCache, FALSE, vWarehouse, vDate);
|
||||
|
||||
INSERT INTO tmp.sale_problems(ticketFk, isAvailable, saleFk)
|
||||
SELECT tl.ticketFk, FALSE, s.id
|
||||
FROM tmp.ticket_list tl
|
||||
JOIN vn.ticket t ON t.id = tl.ticketFk
|
||||
JOIN vn.sale s ON s.ticketFk = t.id
|
||||
JOIN vn.item i ON i.id = s.itemFk
|
||||
JOIN vn.itemType it on it.id = i.typeFk
|
||||
LEFT JOIN cache.available av ON av.item_id = i.id
|
||||
AND av.calc_id = vAvailableCache
|
||||
WHERE date(t.shipped) = vDate
|
||||
AND it.categoryFk != 6
|
||||
AND IFNULL(av.available, 0) < 0
|
||||
AND s.isPicked = FALSE
|
||||
AND NOT i.generic
|
||||
AND vWarehouse = t.warehouseFk
|
||||
GROUP BY tl.ticketFk
|
||||
ON DUPLICATE KEY UPDATE
|
||||
isAvailable = FALSE, saleFk = VALUE(saleFk);
|
||||
|
||||
INSERT INTO tmp.sale_problems(ticketFk, itemShortage, saleFk)
|
||||
SELECT ticketFk, problem, saleFk
|
||||
FROM (
|
||||
SELECT tl.ticketFk, CONCAT('F: ',GROUP_CONCAT(i.id, ' ', i.longName, ' ')) problem, s.id AS saleFk
|
||||
FROM tmp.ticket_list tl
|
||||
JOIN vn.ticket t ON t.id = tl.ticketFk
|
||||
JOIN vn.sale s ON s.ticketFk = t.id
|
||||
JOIN vn.item i ON i.id = s.itemFk
|
||||
JOIN vn.itemType it on it.id = i.typeFk
|
||||
LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk
|
||||
LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache
|
||||
WHERE IFNULL(av.available, 0) < 0
|
||||
AND s.quantity > IFNULL(issw.visible, 0)
|
||||
AND s.quantity > 0
|
||||
AND s.isPicked = FALSE
|
||||
AND s.reserved = FALSE
|
||||
AND it.categoryFk != 6
|
||||
AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate)
|
||||
AND NOT i.generic
|
||||
AND CURDATE() = vDate
|
||||
AND t.warehouseFk = vWarehouse
|
||||
GROUP BY tl.ticketFk LIMIT 1) sub
|
||||
ON DUPLICATE KEY UPDATE
|
||||
itemShortage = sub.problem, saleFk = sub.saleFk;
|
||||
|
||||
INSERT INTO tmp.sale_problems(ticketFk, itemDelay, saleFk)
|
||||
SELECT ticketFk, problem, saleFk
|
||||
FROM (
|
||||
SELECT tl.ticketFk, GROUP_CONCAT('I: ',i.id, ' ', i.longName, ' ') problem, s.id AS saleFk
|
||||
FROM tmp.ticket_list tl
|
||||
JOIN vn.ticket t ON t.id = tl.ticketFk
|
||||
JOIN vn.sale s ON s.ticketFk = t.id
|
||||
JOIN vn.item i ON i.id = s.itemFk
|
||||
JOIN vn.itemType it on it.id = i.typeFk
|
||||
LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk
|
||||
WHERE s.quantity > IFNULL(issw.visible, 0)
|
||||
AND s.quantity > 0
|
||||
AND s.isPicked = FALSE
|
||||
AND s.reserved = FALSE
|
||||
AND it.categoryFk != 6
|
||||
AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate)
|
||||
AND NOT i.generic
|
||||
AND CURDATE() = vDate
|
||||
AND t.warehouseFk = vWarehouse
|
||||
GROUP BY tl.ticketFk LIMIT 1) sub
|
||||
ON DUPLICATE KEY UPDATE
|
||||
itemDelay = sub.problem, saleFk = sub.saleFk;
|
||||
END WHILE;
|
||||
|
||||
CLOSE vCursor;
|
||||
|
||||
INSERT INTO tmp.sale_problems(ticketFk, isTaxDataChecked)
|
||||
SELECT DISTINCT tl.ticketFk, FALSE
|
||||
FROM tmp.ticket_list tl
|
||||
JOIN vn.client c ON c.id = tl.clientFk
|
||||
WHERE c.isTaxDataChecked = FALSE
|
||||
ON DUPLICATE KEY UPDATE
|
||||
isTaxDataChecked = FALSE;
|
||||
|
||||
DROP TEMPORARY TABLE
|
||||
tmp.clientGetDebt,
|
||||
tmp.ticket_list;
|
||||
END;;$$
|
||||
DELIMITER ;
|
|
@ -1,95 +0,0 @@
|
|||
DROP PROCEDURE IF EXISTS `vn`.`ticket_componentMakeUpdate`;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
|
||||
CREATE
|
||||
DEFINER = root@`%` PROCEDURE `vn`.`ticket_componentMakeUpdate`(IN vTicketFk INT, IN vClientFk INT,
|
||||
IN vNickname VARCHAR(50), IN vAgencyModeFk INT,
|
||||
IN vAddressFk INT, IN vZoneFk INT, IN vWarehouseFk TINYINT,
|
||||
IN vCompanyFk SMALLINT, IN vShipped DATETIME,
|
||||
IN vLanded DATE, IN vIsDeleted TINYINT(1),
|
||||
IN vHasToBeUnrouted TINYINT(1), IN vOption INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Modifica en el ticket los campos que se le pasan por parámetro
|
||||
* y cambia sus componentes
|
||||
*
|
||||
* @param vTicketFk Id del ticket a modificar
|
||||
* @param vClientFk nuevo cliente
|
||||
* @param vNickname nuevo alias
|
||||
* @param vAgencyModeFk nueva agencia
|
||||
* @param vAddressFk nuevo consignatario
|
||||
* @param vZoneFk nueva zona
|
||||
* @param vWarehouseFk nuevo almacen
|
||||
* @param vCompanyFk nueva empresa
|
||||
* @param vShipped nueva fecha del envio de mercancia
|
||||
* @param vLanded nueva fecha de recepcion de mercancia
|
||||
* @param vIsDeleted si se borra el ticket
|
||||
* @param vHasToBeUnrouted si se le elimina la ruta al ticket
|
||||
* @param vOption opcion para el case del proc ticketComponentUpdateSale
|
||||
*/
|
||||
DECLARE vPrice DECIMAL(10,2);
|
||||
DECLARE vBonus DECIMAL(10,2);
|
||||
|
||||
CALL ticket_componentPreview (vTicketFk, vLanded, vAddressFk, vZoneFk, vWarehouseFk);
|
||||
|
||||
IF (SELECT addressFk FROM ticket WHERE id = vTicketFk) <> vAddressFk THEN
|
||||
|
||||
UPDATE ticket t
|
||||
JOIN address a ON a.id = vAddressFk
|
||||
SET t.nickname = a.nickname
|
||||
WHERE t.id = vTicketFk;
|
||||
|
||||
END IF;
|
||||
|
||||
CALL zone_getShippedWarehouse(vlanded, vAddressFk, vAgencyModeFk);
|
||||
|
||||
SELECT zoneFk, price, bonus INTO vZoneFk, vPrice, vBonus
|
||||
FROM tmp.zoneGetShipped
|
||||
WHERE shipped BETWEEN DATE(vShipped) AND util.dayEnd(vShipped) AND warehouseFk = vWarehouseFk LIMIT 1;
|
||||
|
||||
UPDATE ticket t
|
||||
SET
|
||||
t.clientFk = vClientFk,
|
||||
t.nickname = vNickname,
|
||||
t.agencyModeFk = vAgencyModeFk,
|
||||
t.addressFk = vAddressFk,
|
||||
t.zoneFk = vZoneFk,
|
||||
t.zonePrice = vPrice,
|
||||
t.zoneBonus = vBonus,
|
||||
t.warehouseFk = vWarehouseFk,
|
||||
t.companyFk = vCompanyFk,
|
||||
t.landed = vLanded,
|
||||
t.shipped = vShipped,
|
||||
t.isDeleted = vIsDeleted
|
||||
WHERE
|
||||
t.id = vTicketFk;
|
||||
|
||||
IF vHasToBeUnrouted THEN
|
||||
UPDATE ticket t SET t.routeFk = NULL
|
||||
WHERE t.id = vTicketFk;
|
||||
END IF;
|
||||
|
||||
IF vOption <> 8 THEN
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.sale;
|
||||
CREATE TEMPORARY TABLE tmp.sale
|
||||
(PRIMARY KEY (saleFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT id AS saleFk, vWarehouseFk warehouseFk
|
||||
FROM sale s WHERE s.ticketFk = vTicketFk;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent;
|
||||
CREATE TEMPORARY TABLE tmp.ticketComponent
|
||||
SELECT * FROM tmp.ticketComponentPreview;
|
||||
|
||||
CALL ticketComponentUpdateSale (vOption);
|
||||
|
||||
DROP TEMPORARY TABLE tmp.sale;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent;
|
||||
END IF;
|
||||
|
||||
DROP TEMPORARY TABLE tmp.zoneGetShipped, tmp.ticketComponentPreview;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
|
@ -40,6 +40,7 @@ TABLES=(
|
|||
vn
|
||||
alertLevel
|
||||
bookingPlanner
|
||||
businessType
|
||||
cplusInvoiceType472
|
||||
cplusInvoiceType477
|
||||
cplusRectificationType
|
||||
|
|
Loading…
Reference in New Issue