

/****** Object:  View [dbo].[V_EST_PROD_TBL_DESC_CARGA_TENTACLE]    Script Date: 11/08/2022 14:53:39 ******/
DROP VIEW [dbo].[V_EST_PROD_TBL_DESC_CARGA_TENTACLE]
GO

/****** Object:  View [dbo].[V_EST_PROD_TBL_DESC_CARGA_TENTACLE]    Script Date: 11/08/2022 14:53:39 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[V_EST_PROD_TBL_DESC_CARGA_TENTACLE]
AS
SELECT CD_EMP,
	CD_TBL_DESC,
	CD_TP_DESCONTO,
	CD_USU,
	DS_TBL_DESC,
	CONVERT (DATE,DT_FIM)as DT_FIM,
	CONVERT (DATE,DT_INI)as DT_INI,
	FLAG_BLOQUEIO_DESC,
	FLAG_DESC_FIX,
	ISNULL(FLAG_DESC_RECEITA, 0) AS FLAG_DESC_RECEITA,
	FLAG_OFERTA_SOBREPOE_TABELA,
	ST_PRORROG,
	STS_TBL_DESC,
	FLAG_APLICA_DESCONTO_QTDE_MULTIPLO,
	FLAG_AGREGAR_DESC_QTDE_AOS_DESCONTOS_EXISTENTES,
	DIAS_INI, 
	DIAS_FIM,
	ORIG_VENDA,
	GETDATE() AS DT_HR_CARGA
	,ISNULL(FLAG_ENVIO_PROPZ,0) AS FLAG_ENVIO_PROPZ
	,ISNULL(FLAG_TP_DESCONTO_PROPZ,0) AS FLAG_TP_DESCONTO_PROPZ

FROM EST_PROD_TBL_DESC TBL
WHERE TBL.CD_EMP = 1
AND TBL.ORIG_VENDA IN ( 0 , 1 )

GO


