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`.`saleTracking_addPrevOK`(vSectorCollectionFk INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Inserta los registros de la colección de sector con el estado PREVIA OK
|
|
|
|
*
|
|
|
|
* @param vSectorCollectionFk Identificador de vn.sectorCollection
|
|
|
|
*/
|
|
|
|
REPLACE vn.saleTracking(
|
|
|
|
saleFk,
|
|
|
|
isChecked,
|
|
|
|
workerFk,
|
|
|
|
stateFk
|
|
|
|
)
|
|
|
|
SELECT sgd.saleFk,
|
|
|
|
TRUE,
|
|
|
|
sc.userFk,
|
|
|
|
s.id
|
|
|
|
FROM vn.sectorCollection sc
|
|
|
|
JOIN vn.sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id
|
|
|
|
JOIN vn.saleGroupDetail sgd ON sgd.saleGroupFk = scsg.saleGroupFk
|
|
|
|
JOIN vn.state s ON s.code = 'OK PREVIOUS'
|
|
|
|
WHERE sc.id = vSectorCollectionFk;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|