 IF OBJECT_ID('V_PAINEL_NFE_DANFE_PENDENTE_VALIDACAO_IMPOSTO_QTDE') IS NOT NULL
	 DROP VIEW	V_PAINEL_NFE_DANFE_PENDENTE_VALIDACAO_IMPOSTO_QTDE
GO
--SELECT * FROM V_PAINEL_NFE_DANFE_PENDENTE_VALIDACAO_IMPOSTO_QTDE	WITH (NOLOCK)
CREATE VIEW V_PAINEL_NFE_DANFE_PENDENTE_VALIDACAO_IMPOSTO_QTDE  AS
SELECT
	COUNT(EST_NF_ENT_DANFE_PROVISORIO.CD_CTR) AS QTDE_PENDENTE
FROM 
	EST_NF_ENT_DANFE_PROVISORIO
WHERE 
	EST_NF_ENT_DANFE_PROVISORIO.CD_EMP=1 
	AND EXISTS (SELECT
				CD_CTR
			FROM
				EST_NF_ENT_DANFE_PROVISORIO_ITENS_VALIDACAO_IMPOSTO_PENDENTE i
			WHERE
				EST_NF_ENT_DANFE_PROVISORIO.CD_CTR = i.CD_CTR)