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

CREATE VIEW V_PARCIAL_DESCONTOS
AS
SELECT	SUM((QT_IT * VLR_IT)-TOT_IT) AS TOTAL 
FROM	PDV_VD VD
INNER	JOIN PDV_VD_IT IT
            ON IT.CD_EMP = VD.CD_EMP AND IT.CD_FILIAL = VD.CD_FILIAL AND VD.CD_VD = IT.CD_VD AND VD.DT_VD = IT.DT_VD
WHERE	VD.DT_VD = CONVERT(VARCHAR,GETDATE(),112) AND ST_VD = 0 AND IT.ST_IT = 1