31 lines
714 B
SQL
31 lines
714 B
SQL
DELIMITER $$
|
|
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
|
|
SET visible = visible - vQuantity,
|
|
available = available - vQuantity
|
|
WHERE id = vItemShelvingFk;
|
|
|
|
UPDATE vn.saleTracking
|
|
SET isChecked = 1
|
|
WHERE saleFk = vSaleFk;
|
|
|
|
END$$
|
|
DELIMITER ;
|