	CREATE
	VIEW VIEW_SINTEGRA_60D
	AS
	(
	select 
		VD.GTIN, 
		I.SERIE,
		VC.DATA_VENDA AS DATA_EMISSAO, 
		M.ID, 
		VD.ECF_ICMS_ST, 
		SUM(VD.QUANTIDADE) AS SOMA_QUANTIDADE, 
		SUM(VD.VALOR_TOTAL) AS SOMA_ITEM, 
		SUM(VD.BASE_ICMS) AS SOMA_BASE_ICMS, 
		SUM(VD.ICMS) AS SOMA_ICMS 
	from 
		ECF_VENDA_CABECALHO VC, ECF_VENDA_DETALHE VD, ECF_IMPRESSORA I, ECF_MOVIMENTO M
	where 
		VC.ID_ECF_MOVIMENTO = M.ID and 
		M.ID_ECF_IMPRESSORA = I.ID and 
		VD.ID_ECF_VENDA_CABECALHO = VC.ID
                AND VD.CANCELADO = 'N'  
	group by 
		VD.GTIN, I.SERIE, VC.DATA_VENDA, M.ID, VD.ECF_ICMS_ST
	)