2024-05-08 08:59:19 +00:00
|
|
|
DELIMITER $$
|
2024-06-11 10:44:25 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sectorCollection_getMyPartial`()
|
2024-05-08 08:59:19 +00:00
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Devuelve las colecciones del sector que corresponden al usuario conectado, y que estan incompletas
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
SELECT DISTINCT sc.id collectionFk, sc.created
|
|
|
|
FROM vn.sectorCollection sc
|
|
|
|
LEFT JOIN vn.sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id
|
|
|
|
LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleGroupFk = scsg.saleGroupFk
|
|
|
|
LEFT JOIN vn.sale sl ON sl.id = sgd.saleFk
|
|
|
|
LEFT JOIN itemShelvingSale iss ON iss.saleFk = sl.id
|
|
|
|
WHERE sc.userFk = account.myUser_getId()
|
|
|
|
AND (ISNULL(scsg.sectorCollectionFk)
|
|
|
|
OR (NOT iss.isPicked))
|
|
|
|
AND sc.created > util.VN_CURDATE() - INTERVAL 1 DAY;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|