21 lines
489 B
SQL
21 lines
489 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`packingListSwitch`(saleFk INT)
|
|
BEGIN
|
|
|
|
DECLARE valueFk INT;
|
|
DECLARE encajando INT DEFAULT 9;
|
|
|
|
SELECT isChecked INTO valueFk
|
|
FROM saleTracking
|
|
WHERE saleFk = saleFk
|
|
AND stateFk = encajando;
|
|
|
|
SET valueFk = (IFNULL(valueFk,0) + 1) MOD 3;
|
|
|
|
REPLACE saleTracking(saleFk, isChecked, workerFk, stateFk)
|
|
VALUES(saleFk,valueFk,account.myUser_getId(),encajando);
|
|
|
|
|
|
END$$
|
|
DELIMITER ;
|