
GO

/****** Object:  View [dbo].[view_tax_objetoTax]    Script Date: 09/06/2013 16:56:03 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[view_tax_objetoTax]'))
DROP VIEW [dbo].[view_tax_objetoTax]
GO

/****** Object:  View [dbo].[view_tax_objetoTax]    Script Date: 09/06/2013 16:56:03 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO


CREATE  VIEW [dbo].[view_tax_objetoTax] AS
SELECT 	[tax_objetoTax].[id] AS [id],
		[tax_objetoTax].[uid] AS [uid],
		[tax_objetoTax].[eid] AS [eid],
		[tax_objetoTax].[id_usuario_modifico] AS [id_usuario_modifico],
		[tax_objetoTax].[id_usuario_creo] AS [id_usuario_creo],
		[tax_objetoTax].[fechaModificacion] AS [fechaModificacion],
		[tax_objetoTax].[fechaCreacion] AS [fechaCreacion],
		[tax_objetoTax].[active] AS [active],
		[tax_objetoTax].[objetoTax] AS [objetoTax],
		[tax_objetoTax].[objetoTax_codigo] AS [objetoTax_codigo],
		[tax_objetoTax].[tabla] AS [tabla],
		[tax_objetoTax].[id_tablaTax] AS [idTablaTax],
		[tax_objetoTax].[id_objTax] AS [idObjTax],
		[tax_objetoTax].[id_nivelTax] AS [id_nivelTax],
[tax_nivelTax].[nivelTax] as [tax_nivelTax_nivelTax],
[tax_nivelTax].[nivelTax_codigo] as [tax_nivelTax_nivelTax_codigo],
[tax_nivelTax].[id_nivelTax] as [tax_nivelTax_id_nivelTax],
[tax_nivelTax].[tabla] as [tax_nivelTax_tabla],
[tax_nivelTax].[filtro] as [tax_nivelTax_filtro],
[tax_nivelTax].[columnaPrincipal] as [tax_nivelTax_columnaPrincipal],
[tax_nivelTax].[esEquipo] as [tax_nivelTax_esEquipo],
		[tax_objetoTax].[orden] AS [orden],
		[empresaCodigo].[empresa] As [multiempresa]
FROM [tax_objetoTax]
	INNER JOIN [seg_usuario] AS [seg_usuario_modifico] ON [seg_usuario_modifico].id=[tax_objetoTax].[id_usuario_modifico]
	INNER JOIN [seg_usuario] AS [seg_usuario_creo] ON [seg_usuario_creo].id=[tax_objetoTax].[id_usuario_creo]
	INNER JOIN [tax_nivelTax] ON [tax_nivelTax].id=[tax_objetoTax].[id_nivelTax]
	INNER JOIN [gen_empresa] AS empresaCodigo ON [tax_objetoTax].eid = [empresaCodigo].[codigo] and empresaCodigo.active=1
WHERE [tax_objetoTax].active=1


GO


