2024-05-08 08:59:19 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`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()
|
2024-06-11 16:43:26 +00:00
|
|
|
AND (scsg.sectorCollectionFk IS NULL OR NOT iss.isPicked)
|
2024-05-08 08:59:19 +00:00
|
|
|
AND sc.created > util.VN_CURDATE() - INTERVAL 1 DAY;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|