IF OBJECT_ID('V_ORCAMENTO_CONVENIO') IS NOT NULL 
	DROP VIEW V_ORCAMENTO_CONVENIO 
GO 

-- DROP VIEW V_ORCAMENTO_CONVENIO
CREATE  VIEW V_ORCAMENTO_CONVENIO
AS
SELECT 	ORC.CD_EMP, ORC.CD_FILIAL, ORC.CD_ORC, ORC.DT_EMI, ORC.HR_EMI, ORC.NR_PED_TELEVD AS NR_PEDIDO
	,CONV.CD_CONV, CONV.DS_CONV AS NM_CONV, ORC.PERC_REC_CONV, ORC.TP_PERC_REC_CONV, ORC.QT_PARC_CONV, 0 AS QTD_DIAS_PRORROG
	, 0 AS IMPRIMIR_COMPROVANTE
FROM 	EST_ORC ORC
LEFT 	JOIN RC_CLI_CONV CONV ON ORC.CD_EMP = CONV.CD_EMP AND ORC.CD_CONV = CONV.CD_CONV
WHERE	ORC.CD_CONV IS NOT NULL AND ORC.CD_CONV != 0