Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
6| Name | Data Type | Length | Description |
|---|---|---|---|
| @p_cuitbaja | varchar | 30 | |
| @p_idpadronbaja | int | 4 | |
| @p_cuitalta | varchar | 30 | |
| @p_idpadronalta | int | 4 | |
| @p_userid | int | 4 | |
| @p_fecha | date | 3 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
/*
SELECT top 10 * FROM cambios_cuit order by created desc
select * from clientes where nombre_cliente like '%demo%'
select * from led_contratistas where cliente = 3920694
select * from led_empleados where cliente = 3920694
select * from ln_contrapartes where cliente = 3920694
update led_contratistas set id_padron= 22780396 where contratista = 5636 -- 1532056
update led_empleados set id_padron= 22780396 where empleado= 101296 -- 19445056
update ln_contrapartes set id_padron= 22780396 where contraparte= 3 -- 17801643
parametros --> @cuit_baja, @id_padron_baja, @cuit_alta, @id_padron_alta, @id_usuario, @fecha
exec cambios_cuit_update '27627334570', 205821605, '27191110094', 213678223, 15342812, '2024-12-10'
*/
CREATE OR ALTER PROCEDURE dbo.cambios_cuit_update
-- Add the parameters for the stored procedure here
@p_cuitbaja varchar(30),
@p_idpadronbaja int,
@p_cuitalta varchar(30),
@p_idpadronalta int,
@p_userid int,
@p_fecha date
AS
BEGIN
SET NOCOUNT ON;
begin try
begin
insert into cambios_cuit
(
cuit,
id_padron,
cuit_inactivo,
id_padron_inactivo,
fecha,
visible,
origen_del_dato ,
created,
modified
)
values
(@p_cuitalta,
@p_idpadronalta,
@p_cuitbaja,
@p_idpadronbaja,
@p_fecha,
'1',
'AFIP',
GETDATE(),
null)
/* ACTUALIZAMOS CONTRATISTAS DE IMPERIUM */
UPDATE led_contratistas set id_padron=@p_idpadronalta where id_padron=@p_idpadronbaja /* and estado_contratista='A'*/
/* ACTUALIZAMOS EMPLEADOS DE IMPERIUM */
UPDATE led_empleados set id_padron=@p_idpadronalta where id_padron=@p_idpadronbaja /* and estado_contratista='A'*/
/* ACTUALIZAMOS CONTRAPARTES DE LED */
UPDATE LN_contrapartes set id_padron=@p_idpadronalta where id_padron=@p_idpadronbaja /* and estado_contratista='A'*/
/* ACTUALIZAMOS BLUE */
UPDATE informes set numero=@p_cuitalta where numero=@p_cuitbaja /* and estado_contratista='A'*/
select 'ok' as ok
end
end try
begin catch
select ERROR_MESSAGE() as error
end catch
END
GO
GO
/*
SELECT top 10 * FROM cambios_cuit order by created desc
select * from clientes where nombre_cliente like '%demo%'
select * from led_contratistas where cliente = 3920694
select * from led_empleados where cliente = 3920694
select * from ln_contrapartes where cliente = 3920694
update led_contratistas set id_padron= 22780396 where contratista = 5636 -- 1532056
update led_empleados set id_padron= 22780396 where empleado= 101296 -- 19445056
update ln_contrapartes set id_padron= 22780396 where contraparte= 3 -- 17801643
parametros --> @cuit_baja, @id_padron_baja, @cuit_alta, @id_padron_alta, @id_usuario, @fecha
exec cambios_cuit_update '27627334570', 205821605, '27191110094', 213678223, 15342812, '2024-12-10'
*/
CREATE OR ALTER PROCEDURE dbo.cambios_cuit_update
-- Add the parameters for the stored procedure here
@p_cuitbaja varchar(30),
@p_idpadronbaja int,
@p_cuitalta varchar(30),
@p_idpadronalta int,
@p_userid int,
@p_fecha date
AS
BEGIN
SET NOCOUNT ON;
begin try
begin
insert into cambios_cuit
(
cuit,
id_padron,
cuit_inactivo,
id_padron_inactivo,
fecha,
visible,
origen_del_dato ,
created,
modified
)
values
(@p_cuitalta,
@p_idpadronalta,
@p_cuitbaja,
@p_idpadronbaja,
@p_fecha,
'1',
'AFIP',
GETDATE(),
null)
/* ACTUALIZAMOS CONTRATISTAS DE IMPERIUM */
UPDATE led_contratistas set id_padron=@p_idpadronalta where id_padron=@p_idpadronbaja /* and estado_contratista='A'*/
/* ACTUALIZAMOS EMPLEADOS DE IMPERIUM */
UPDATE led_empleados set id_padron=@p_idpadronalta where id_padron=@p_idpadronbaja /* and estado_contratista='A'*/
/* ACTUALIZAMOS CONTRAPARTES DE LED */
UPDATE LN_contrapartes set id_padron=@p_idpadronalta where id_padron=@p_idpadronbaja /* and estado_contratista='A'*/
/* ACTUALIZAMOS BLUE */
UPDATE informes set numero=@p_cuitalta where numero=@p_cuitbaja /* and estado_contratista='A'*/
select 'ok' as ok
end
end try
begin catch
select ERROR_MESSAGE() as error
end catch
END
GO
Depends On
5Used By
No items found