2019-03-04 07:35:39 +00:00
|
|
|
/* Añadir a producción cuando se suba salix */
|
|
|
|
|
2019-02-28 07:55:34 +00:00
|
|
|
DROP TRIGGER IF EXISTS vn2008.ConsignatariosAfterUpdate;
|
|
|
|
USE vn2008;
|
|
|
|
|
|
|
|
DELIMITER $$
|
|
|
|
$$
|
|
|
|
CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`ConsignatariosAfterUpdate` AFTER UPDATE ON `Consignatarios` FOR EACH ROW
|
|
|
|
BEGIN
|
|
|
|
|
|
|
|
-- Recargos de equivalencia distintos implican facturacion por consignatario
|
|
|
|
IF NEW.isEqualizated != OLD.isEqualizated THEN
|
|
|
|
|
|
|
|
IF
|
|
|
|
(SELECT COUNT(*) FROM
|
|
|
|
(
|
|
|
|
SELECT DISTINCT (isEqualizated = FALSE) as Equ
|
|
|
|
FROM Consignatarios
|
|
|
|
WHERE Id_Cliente = NEW.Id_Cliente
|
|
|
|
) t1
|
|
|
|
) > 1
|
|
|
|
|
|
|
|
THEN
|
|
|
|
|
|
|
|
UPDATE Clientes
|
|
|
|
SET invoiceByAddress = TRUE
|
|
|
|
WHERE Id_Cliente = NEW.Id_Cliente;
|
|
|
|
|
|
|
|
END IF;
|
|
|
|
|
|
|
|
END IF;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|
|
|
|
USE vn;
|