IF EXISTS (SELECT 1 FROM dbo.sysobjects WHERE ID = OBJECT_ID(N'[dbo].[sp_fco_cambio_vw_iss]') 
AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
   DROP PROCEDURE dbo.sp_fco_cambio_vw_iss
GO
SET QUOTED_IDENTIFIER OFF
GO
CREATE PROCEDURE dbo.sp_fco_cambio_vw_iss
(
	@CIA  		char(4),
	@TABLA  	varchar(30),
	@COD_TRAB	char(10),
	@C10A  		char(4),
	@C11A  		char(1),
	@C11B  		char(1),
	@C11C  		char(1),
	@C11D  		numeric(2,0),
	@C11E  		numeric(2,0),
  @C12A           numeric(2,0),
	@C13A  		numeric(12,0),
  @C14A           numeric(10,0),
  @C14B           numeric(10,0),
  @C14C           numeric(10,0)
)
/******************************************************************************************/
/*** Nombre:      sp_cambio_mf_iss	                            			***/
/*** Modulo:      ADAM V3. (Fiscal Colombiano)                                          ***/
/*** Descripcion: permite al usuario corregir las leves inconsistencias que             ***/
/***    ocasionalmente puedan presentarse en el reporte ISS             		***/
/***              o en el medio magnético        					***/
/***  Revision: Abril 5 de 2002                                                         ***/
/******************************************************************************************/
AS
DECLARE	@sql  VARCHAR(1500)

BEGIN
	SELECT @sql = "UPDATE " + @TABLA +
     	" SET" +
	" C10A='" + IsNull(RTrim(@C10A),"C") + "'," +
     	" C11A='" + IsNull(@C11A,"") + "'," +
     	" C11B='" + IsNull(@C11B,"") + "'," +
     	" C11C='" + IsNull(@C11C,"") + "'," +
     	" C11D=" + IsNull(Convert(char,@C11D),"0") + "," +
     	" C11E=" + IsNull(Convert(char,@C11E),"0") + "," +
     	" C12A=" + IsNull(CONVERT(CHAR,@C12A),"0") + "," + 
     	" C13A=" + IsNull(CONVERT(CHAR,@C13A),"0") + "," +
     	" C14A=" + IsNull(CONVERT(CHAR,@C14A),"0") + "," +
     	" C14B=" + IsNull(CONVERT(CHAR,@C14B),"0") + "," +
     	" C14C=" + IsNull(CONVERT(CHAR,@C14C),"0") +
    	" WHERE CIA='" + @CIA + "'" +
    	" AND COD_TRAB='" + @COD_TRAB + "'"
	EXECUTE (@sql)

     	IF @@ERROR <> 0 RAISERROR 13000 "Error al Actualizar la Tabla"
END


GO
GRANT EXECUTE ON sp_fco_cambio_vw_iss TO Public
GO