CREATE OR REPLACE VIEW ESTVENDA
AS
   SELECT P.CDFILIAL,
          P.CDPRODUTO,
          SUM(P.QTTOTALESTOQ) AS QTTOTALESTOQ
   FROM POSESTATU P, LOCALESTOQUE L
   WHERE (L.CDFILIAL     = P.CDFILIAL)     AND
         (L.CDALMOXARIFE = P.CDALMOXARIFE) AND
         (L.CDLOCALESTOQ = P.CDLOCALESTOQ) AND
         (L.IDDISPCONPED = 'S')
   GROUP BY P.CDFILIAL,
            P.CDPRODUTO
/
