IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'doc_itemDocumento' AND COLUMN_NAME = 'porcentajeMargen')
BEGIN
	ALTER TABLE [doc_itemDocumento]
	ADD [porcentajeMargen] FLOAT
END
GO

IF NOT EXISTS (SELECT 1 FROM [_columnas] WHERE [tabla] = 'doc_itemDocumento' AND [columna] = 'porcentajeMargen')
BEGIN  
	INSERT INTO [dbo].[_columnas]
			   ([tabla]
			   ,[columna]
			   ,[mostrarEnGrilla]
			   ,[ordenGrilla]
			   ,[requerido]
			   ,[tipo]
			   ,[defecto]
			   ,[tamano]
			   ,[id_seccionAtributo]
			   ,[mostrarEnAPI]
			   ,[dependiente])
		 VALUES
			   ('doc_itemDocumento'
			   ,'porcentajeMargen'
			   ,1
			   ,1
			   ,0
			   ,'float'
			   ,NULL
			   ,NULL
			   ,0
			   ,0
			   ,NULL)
END
GO

IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'doc_itemDocumento' AND COLUMN_NAME = 'margenPlaneado')
BEGIN
	ALTER TABLE [doc_itemDocumento]
	ADD [margenPlaneado] FLOAT
END
GO

IF NOT EXISTS (SELECT 1 FROM [_columnas] WHERE [tabla] = 'doc_itemDocumento' AND [columna] = 'margenPlaneado')
BEGIN  
	INSERT INTO [dbo].[_columnas]
			   ([tabla]
			   ,[columna]
			   ,[mostrarEnGrilla]
			   ,[ordenGrilla]
			   ,[requerido]
			   ,[tipo]
			   ,[defecto]
			   ,[tamano]
			   ,[id_seccionAtributo]
			   ,[mostrarEnAPI]
			   ,[dependiente])
		 VALUES
			   ('doc_itemDocumento'
			   ,'margenPlaneado'
			   ,1
			   ,1
			   ,0
			   ,'float'
			   ,NULL
			   ,NULL
			   ,0
			   ,0
			   ,NULL)
END
GO
