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

23 lines
517 B
MySQL
Raw Normal View History

DELIMITER $$
2024-08-20 08:06:10 +00:00
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`saleTracking_add`(vSaleGroupFk INT)
BEGIN
/** Inserta en vn.saleTracking las lineas de una previa
*
* @param vSaleGroupFk Identificador de vn.saleGroup
*/
REPLACE vn.saleTracking(
saleFk,
isChecked,
workerFk,
stateFk
)
SELECT sgd.saleFk ,
TRUE,
account.myUser_getId(),
s.id
FROM vn.saleGroupDetail sgd
JOIN vn.state s ON s.code = 'ON_PREPARATION'
WHERE sgd.saleGroupFk = vSaleGroupFk;
END$$
DELIMITER ;