salix/db/routines/vn/procedures/itemShelvingSale_Add.sql

31 lines
714 B
MySQL
Raw Normal View History

DELIMITER $$
2024-08-20 08:06:10 +00:00
CREATE OR REPLACE DEFINER=`vn`@`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
2024-09-24 14:48:48 +00:00
SET visible = visible - vQuantity,
available = available - vQuantity
WHERE id = vItemShelvingFk;
UPDATE vn.saleTracking
SET isChecked = 1
WHERE saleFk = vSaleFk;
END$$
DELIMITER ;