SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO


IF EXISTS (SELECT * FROM sys.objects 
   WHERE object_id = OBJECT_ID(N'Pvta_FacturaH_Impuestos') )
DROP View Pvta_FacturaH_Impuestos
GO

Create VIEW Pvta_FacturaH_Impuestos
AS 
/* =================================
	Date: Feb 02,2016
   =================================	      
*/

  Select Id_Fali,Id_Impu,
         Importe_Imp,
         Cantidad     = dbo.Get_Cant_Art_Post_Hist(id_fali),
         Tot_Impuesto = Sum(importe_imp * dbo.Get_Cant_Art_Post_Hist(id_fali))
     From RESTHFAI 
     Group by id_impu,id_fali,importe_imp


GO

