   
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[V_SERVICE_FARMA_INDICADORES_VAZIO]'))
DROP VIEW [dbo].[V_SERVICE_FARMA_INDICADORES_VAZIO]
GO
   
SET QUOTED_IDENTIFIER ON
GO
 
CREATE VIEW [dbo].[V_SERVICE_FARMA_INDICADORES_VAZIO] AS 
--TIPO DE VENDA
SELECT
	'' DT_MOV,
	'TIPO VENDA' AS TIPO_MOV,
	0 AS VLR_VENDA_SEM_DEVOLUCAO,
	0 AS VLR_DEVOLUCAO,
	0 AS VLR_VENDA_FINAL,
	'P_SERVICE_FARMA_VENDAS_TIPO' AS PROCED,
	0 AS FLAG_PARA,
	0 AS VLR_CUSTO_MEDIO 
	
UNION ALL
--CALL CENTER
SELECT
	'' DT_MOV,
	'CALL CENTER' AS TIPO_MOV,
	0 VLR_VENDA ,
	0 VLR_DEVOLUCAO,
	0 AS VLR_VENDA_FINAL,
	'P_SERVICE_FARMA_VENDAS_TIPO_CALL' AS PROCED,
	0 AS FLAG_PARA,
	0 AS VLR_CUSTO_MEDIO 
	
	
UNION ALL
--AREA ATENDIMENTO
SELECT
	'' DT_MOV,
	'AREA ATENDIMENTO' AS TIPO_MOV,
	0 VLR_VENDA,
	0 VLR_DEVOLUCAO,
	0 AS VLR_VENDA_FINAL,
	'P_SERVICE_FARMA_VENDAS_AREA_ATENDIMENTO' AS PROCED,
	0 AS FLAG_PARA,
	0 AS VLR_CUSTO_MEDIO
 
UNION ALL
--VENDAS LINHA
SELECT
	'' DT_MOV,
	'VENDAS LINHAS' AS TIPO_MOV,
	0 VLR_VENDA ,
	0,
	0 AS VLR_VENDA_FINAL,
	'P_SERVICE_FARMA_VENDAS_LINHAS' AS PROCED,
	0 AS FLAG_PARA,
	0 AS VLR_CUSTO_MEDIO
 
UNION ALL	
--VARIAVEL	
SELECT
	'' DATA,
	'VARIAVEL' AS TIPO_MOV,
	0,
	0,
	0 VENDA_VLR,
	'P_SERVICE_FARMA_VARIAVEL' AS PROCED,
	0 AS FLAG_PARA,
	0 AS VLR_CUSTO_MEDIO
UNION ALL	
--PLANO REMUNERACAO	
SELECT
	'' DT_MOV,
	'PLANO REMUNERACAO' AS TIPO_MOV,
	0 VLR_VENDA,
	0 VLR_DEVOLUCAO,
	0 AS VLR_VENDA_FINAL,
	'P_SERVICE_FARMA_VENDAS_PLANO_REMUNERACAO' AS PROCED,
	0 AS FLAG_PARA,
	0 AS VLR_CUSTO_MEDIO

UNION ALL
--DESCONTO
SELECT
	'' DT_VD,
	'TIPO DESCONTO' AS TIPO_MOV,
	0 VENDA_LIQ,
	0,
	0,
	'P_SERVICE_FARMA_DESCONTO' AS PROCED,
	1 AS FLAG_PARA,
	0 AS VLR_CUSTO_MEDIO 
	
UNION ALL	
--INPETOR GERAL	
SELECT
	'' DATA,
	'INSPETOR GERAL' AS TIPO_MOV,
	0 VDA_REDE_VLR,
	0 DEV_REDE_VLR,
	0 AS VLR_VENDA_FINAL,
	'P_SERVICE_FARMA_INSPETOR' AS PROCED,
	0 AS FLAG_PARA,
	0 AS VLR_CUSTO_MEDIO 
	
UNION ALL	
--VENDAS DIARIA	
SELECT
	'' DT_VD,
	'VENDAS DIARIA' AS TIPO_MOV,
	0 ,
	0,
	0,
	'P_SERVICE_FARMA_MOV_DIARIO' AS PROCED,
	1 AS FLAG_PARA,
	0 AS VLR_CUSTO_MEDIO
 


GO


