IF OBJECT_ID('dbo.sp_fdt_rea_aum_emb_ns') IS NOT NULL
   DROP PROCEDURE dbo.sp_fdt_rea_aum_emb_ns
GO
CREATE PROCEDURE dbo.sp_fdt_rea_aum_emb_ns
(
    @pch_compania      char(4),
    @psi_id_calendario smallint
)
/*********************************************************************/
/*** Modulo:      Módulo Fiscal Colombiano - Embargos              ***/
/*** Descripcion: aumenta cuota fija de embargos                   ***/
/*** Autor:	  Laura A. Guzman M                                    ***/
/*** Fecha:	  Junio 29 de 2006                                     ***/
/*** Motor:	  SQL Server 2000	Version interna: 1.00              ***/
/*********************************************************************/
AS
BEGIN
    UPDATE
        fdt_embargos
    SET
        cuota_fija = cuota_anterior
    FROM
        fdt_hist_aum_emb a
    WHERE
        a.compania = fdt_embargos.compania And
        a.trabajador = fdt_embargos.trabajador And
        a.concepto = fdt_embargos.concepto And
        a.secuencia = fdt_embargos.secuencia And
        fdt_embargos.compania = @pch_compania And
        a.id_calendario = @psi_id_calendario 

    DELETE
        fdt_hist_aum_emb
    WHERE
        compania = @pch_compania And
        id_calendario = @psi_id_calendario
    

END
GO
GRANT EXECUTE ON dbo.sp_fdt_rea_aum_emb_ns TO PUBLIC
GO
