IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[V_EST_NF_ENT_IT_DAR_GERADO]'))
/****** Object:  View [dbo].[V_EST_NF_ENT_IT_DAR_GERADO]    Script Date: 08/01/2014 01:17:52 ******/
DROP VIEW [dbo].[V_EST_NF_ENT_IT_DAR_GERADO]
GO

--VERSAO 2488
CREATE VIEW [dbo].[V_EST_NF_ENT_IT_DAR_GERADO] AS 
SELECT       
	EST_NF_ENT_DAR_IT.CD_EMP, 
	EST_NF_ENT_DAR_IT.CD_FILIAL, 
	EST_NF_ENT_DAR_IT.CD_NF, 
	EST_NF_ENT_DAR_IT.CD_PROD, 
    EST_NF_ENT_DAR_IT.CD_DAR, 
	EST_NF_ENT_DAR_IT.VLR_BASE_ICMS, 
	EST_NF_ENT_DAR_IT.VLR_ICMS_SUBS, 
	EST_NF_ENT_DAR_IT.VLR_BASE_SUBS,
	EST_NF_ENT_IT.QT_IT,
	isnull(EST_NF_ENT_IT.VLR_COFINS + EST_NF_ENT_IT.VLR_PIS,0) VLR_PIS_COFINS
FROM            
	EST_NF_ENT_DAR_IT INNER JOIN EST_NF_ENT_IT ON 
	EST_NF_ENT_DAR_IT.CD_EMP = EST_NF_ENT_IT.CD_EMP AND 
	EST_NF_ENT_DAR_IT.CD_FILIAL = EST_NF_ENT_IT.CD_FILIAL AND 
    EST_NF_ENT_DAR_IT.CD_NF = EST_NF_ENT_IT.CD_NF AND 
	EST_NF_ENT_DAR_IT.CD_PROD = EST_NF_ENT_IT.CD_PROD

