<pre>
SET @Presupuesto = 50;
SET @PresupuestoItem = 3;
SET @Lista = 1;
SET @Ancho =1000;
SET @Alto = 1000;
SET @Cantidad = 1;
SET @Coeficiente = 1;
SELECT 
    V1.VidQuoteID,
    V1.VidQuoteItem,
    V1.VidQuoteProdID,
    V1.VidQuoteElementoID,
    V1.VidQuoteComposicID,
    V3.ElementoID,
    V3.ElementoPM,
    SUM(CalculoPrecio(
        @Ancho, 
        @Alto,
        (CASE (@Lista)
          WHEN 0 THEN V4.PrecioProd00
          WHEN 1 THEN V4.PrecioProd01
          WHEN 2 THEN V4.PrecioProd02
          WHEN 3 THEN V4.PrecioProd03
        END),
        V5.Magnitud,
        V2.OffsetVanoAlto + V3.OffsetVanoAlto,
        V2.OffsetVanoAncho + V3.OffsetVanoAncho,
        V2.CoefVanoAlto * V3.CoefVanoAlto,
        V2.CoefVanoAncho * V3.CoefVanoAncho,
        V2.ValorElemento * V3.ValorElemento)) * @Coeficiente AS VidQuotePrecio,
    SUM(CalculoPrecio(
        @Ancho, 
        @Alto,
        (CASE (@Lista)
          WHEN 0 THEN V4.PrecioProd00
          WHEN 1 THEN V4.PrecioProd01
          WHEN 2 THEN V4.PrecioProd02
          WHEN 3 THEN V4.PrecioProd03
        END),
        V5.Magnitud,
        V2.OffsetVanoAlto + V3.OffsetVanoAlto,
        V2.OffsetVanoAncho + V3.OffsetVanoAncho,
        V2.CoefVanoAlto * V3.CoefVanoAlto,
        V2.CoefVanoAncho * V3.CoefVanoAncho,
        V2.ValorElemento * V3.ValorElemento)) * @Coeficiente * @Cantidad AS VidQuotePrecioP, 
    V5.Magnitud
FROM
    fzggestion.composicion AS V3,
    fzggestion.composicion AS V2,
    fzggestion.vidquoten3 AS V1,
    fzggestion.precios AS V4,
    fzggestion.productos AS V5
WHERE
    V3.ProductoID = V2.ElementoID AND 
    V2.ProductoID = V1.VidQuoteProdID AND 
    V2.ElementoID = V1.VidQuoteElementoID AND 
    V2.ComposicID = V1.VidQuoteComposicID AND 
    V4.ProductoID = V3.ElementoID AND 
    V5.ProductoID = V4.ProductoID AND 
    V1.VidQuoteProdID <> V1.VidQuoteElementoID AND 
    V3.ElementoPM = 0
GROUP BY V1.VidQuoteElementoID , V1.VidQuoteComposicID
</pre>