DELIMITER $$ CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`itemShelvingSale_Add`(vItemShelvingFk INT, vSaleFk INT, vQuantity INT) BEGIN /** * Añade línea a itemShelvingSale y regulariza el carro * * @param vItemShelvingFk Id itemShelving * @param vSaleFk Id de sale * @param vQuantity cantidad a regularizar */ INSERT INTO itemShelvingSale(itemShelvingFk, saleFk, quantity, userFk) VALUES (vItemShelvingFk, vSaleFk, vQuantity, getUser()); UPDATE itemShelving SET visible = visible - vQuantity WHERE id = vItemShelvingFk; UPDATE vn.saleTracking SET isChecked = 1 WHERE saleFk = vSaleFk; END$$ DELIMITER ;