	CREATE
	VIEW VIEW_SINTEGRA_60R
	AS
	(
	SELECT 
		VD.GTIN, 
		I.SERIE,
		VC.DATA_VENDA AS DATA_EMISSAO, 
		MONTH(VC.DATA_VENDA) AS MES_EMISSAO, 
		YEAR(VC.DATA_VENDA) AS ANO_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
	GROUP BY 
		MES_EMISSAO, ANO_EMISSAO, VD.GTIN
	)