
/****** Object:  View [dbo].[V_EST_PROD_TBL_DESC_QTDE_CARGA_TENTACLE]    Script Date: 11/08/2022 14:59:06 ******/
DROP VIEW [dbo].[V_EST_PROD_TBL_DESC_QTDE_CARGA_TENTACLE]
GO

/****** Object:  View [dbo].[V_EST_PROD_TBL_DESC_QTDE_CARGA_TENTACLE]    Script Date: 11/08/2022 14:59:06 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[V_EST_PROD_TBL_DESC_QTDE_CARGA_TENTACLE]
AS
SELECT
	AGREGACAO
	, CD_EMP
	, CD_TBL_DESC_QTDE
	, CD_TP_DESCONTO
	, DS_TBL_DESC_QTDE
	, CONVERT(DATE, DT_FIM) AS DT_FIM
	, CONVERT(DATE, DT_INI) AS DT_INI
	, QTDE_LEVE
	, QTDE_PAGUE
	, STS_TBL_DESC
	, 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_QTDE
WHERE EST_PROD_TBL_DESC_QTDE.CD_EMP = 1
AND EST_PROD_TBL_DESC_QTDE.ORIG_VENDA IN ( 0 , 1 );
GO


