IF  EXISTS (SELECT * FROM SYS.VIEWS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[V_PDV_CUPOM_NAO_FISCAL_TEF]'))
DROP VIEW [dbo].[V_PDV_CUPOM_NAO_FISCAL_TEF]
GO  
CREATE VIEW V_PDV_CUPOM_NAO_FISCAL_TEF AS 
SELECT       
	PDV_CUPOM_NAO_FISCAL_TEF.CD_EMP, 
	PDV_CUPOM_NAO_FISCAL_TEF.CD_FILIAL, 
	PDV_CUPOM_NAO_FISCAL_TEF.CD_CTR, 
	PDV_CUPOM_NAO_FISCAL_TEF.CD_RECTO_TEF, 
    PDV_RECBTO_TEF.CD_ADM_CARTAO, 
	PDV_RECBTO_TEF.NR_AUTORIZACAO, 
	PDV_RECBTO_TEF.COD_REDE, 
	PDV_RECBTO_TEF.COD_MODALIDADE, 
	PDV_RECBTO_TEF.COD_BANDEIRA, 
    PDV_RECBTO_TEF.VL_CARTAO, 
	PDV_RECBTO_TEF.NSU_SITEF, 
	PDV_RECBTO_TEF.VL_SAQUE_CARTAO, 
	PDV_RECBTO_TEF.TRN_POS, 
	PDV_RECBTO_TEF.ST_TRN, 
	PDV_RECBTO_TEF.NM_OPERADORA_PDV, 
    PDV_RECBTO_TEF.QTDE_PARCELAS
FROM            
	PDV_CUPOM_NAO_FISCAL_TEF INNER JOIN PDV_RECBTO_TEF ON 
	PDV_CUPOM_NAO_FISCAL_TEF.CD_EMP = PDV_RECBTO_TEF.CD_EMP AND 
	PDV_CUPOM_NAO_FISCAL_TEF.CD_FILIAL = PDV_RECBTO_TEF.CD_FILIAL AND 
	PDV_CUPOM_NAO_FISCAL_TEF.CD_RECTO_TEF = PDV_RECBTO_TEF.CD_RECTO_TEF
WHERE        
	PDV_RECBTO_TEF.VL_CARTAO > 0