2024-01-15 11:31:03 +00:00
|
|
|
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)
|
2024-01-15 11:31:03 +00:00
|
|
|
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
|
2024-01-15 11:31:03 +00:00
|
|
|
WHERE id = vItemShelvingFk;
|
|
|
|
|
|
|
|
UPDATE vn.saleTracking
|
|
|
|
SET isChecked = 1
|
|
|
|
WHERE saleFk = vSaleFk;
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|