19 lines
740 B
SQL
19 lines
740 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sectorCollection_getMyPartial`()
|
|
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 (scsg.sectorCollectionFk IS NULL OR NOT iss.isPicked)
|
|
AND sc.created > util.VN_CURDATE() - INTERVAL 1 DAY;
|
|
END$$
|
|
DELIMITER ;
|