refs #6321 feat: vCustomWhere

This commit is contained in:
Javier Segarra 2024-01-22 10:10:38 +01:00
parent 0111aa1b75
commit 2bcb6366b2
1 changed files with 2 additions and 5 deletions

View File

@ -2,7 +2,7 @@ DROP PROCEDURE IF EXISTS vn.item_getLack;
DELIMITER $$
$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getLack`(IN vForce BOOLEAN, IN vDays INT, IN vSearch VARCHAR(500))
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getLack`(IN vForce BOOLEAN, IN vDays INT, IN vCustomWhere VARCHAR(500))
BEGIN
/**
* Calcula una tabla con el máximo negativo visible para cada producto y almacen
@ -12,15 +12,11 @@ BEGIN
* @param vSearch Filtro items
**/
DECLARE vIsSearch BOOL DEFAULT vSearch IS NOT NULL AND vSearch <> '';
CALL `cache`.stock_refresh(vForce);
CALL item_getMinacum(NULL, util.VN_CURDATE(), vDays, NULL);
CALL item_getMinETD();
CALL item_zoneClosure();
IF vIsSearch THEN
SET vSearch =' ';
END IF;
SELECT i.id itemFk,
i.longName,
@ -54,6 +50,7 @@ BEGIN
WHERE w.isForTicket
AND ic.display
AND it.code != 'GEN'
AND (vCustomWhere IS NULL OR vCustomWhere = '' OR vCustomWhere)
GROUP BY i.id, w.id
HAVING lack < 0;