CREATE VIEW VW_GRAF_ENTRADA (TOTAL,DATA) AS
SELECT SUM(DINHEIRO + VISA + MASTER + HIPER + CHEQUE + NOTA + DEBVISA + DEBMASTER) AS VALOR,
       DATA_SAIDA AS DATA
FROM WALK_IN
WHERE BAIXA = 'S'
AND EXCLUIDO = 'N'
GROUP BY 2
UNION
SELECT SUM(DINHEIRO + VISA + MASTER + HIPER + CHEQUE + DEBVISA + DEBMASTER) AS TOTAL,
       DATA AS DATA
FROM DESPESA_AVULSA
GROUP BY 2
UNION
SELECT SUM(VALOR) AS TOTAL,
       DATA_ADIC AS DATA
FROM ADIC_CAIXA
GROUP BY 2
ORDER BY 2;

UPDATE PARAMETROS SET SCRIPT = '099';
