![]() | Products |
| Home » Technical Support » ElevateDB Technical Support » Incident Reports » Incident Reports Reported for Version 2.12 » View Incident Report |
| Reported By: Mario Enriquez Reported On: 4/30/2013 For: Version 2.12 Build 2 |
CREATE FUNCTION "fnInvExistenciaSucursal" (IN pIdProductoEmpresa GUID, IN pIdSucursal GUID, IN pFechaMov DATE) RETURNS DECIMAL(19,4)
BEGIN
DECLARE Result DECIMAL(19,4);
EXECUTE IMMEDIATE
'SELECT sum((pe.cantidad_inicial + pe.ingresos) - pe.salidas)
INTO ?
FROM inv_producto_existencia pe
INNER JOIN
(
SELECT a.id_producto_empresa,
a.id_ubicacion,
MAX(a.fecha) fecha
FROM inv_producto_existencia a
WHERE a.id_producto_empresa = ? AND
a.id_ubicacion IN
(SELECT id_ubicacion FROM inv_bodega_ubicacion WHERE id_bodega IN
(SELECT id_bodega FROM inv_bodega WHERE id_sucursal = ?))
AND a.fecha <= ?
GROUP BY id_producto_empresa, id_ubicacion
) AS uf
ON
pe.id_producto_empresa = uf.id_producto_empresa AND
pe.id_ubicacion = uf.id_ubicacion AND
pe.fecha = uf.fecha
GROUP BY pe.id_producto_empresa'
USING Result, pIdProductoEmpresa, pIdSucursal, pFechaMov;
RETURN COALESCE(Result, 0.0);
ENDThis web page was last updated on Wednesday, April 8, 2026 at 04:38 AM | Privacy Policy © 2026 Elevate Software, Inc. All Rights Reserved Questions or comments ? |

