Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
3| Name | Data Type | Length | Description |
|---|---|---|---|
| @p_cliente | int | 4 | |
| @p_contratista | int | 4 | |
| @p_user_id | int | 4 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
-- =============================================
-- Author: Luis Prenafeta
-- Create date: 11/11/2019
-- Description: Para validar un login remoto desde backend a la web de contratistas utlizando el cliente, el contratista y el usuario.
-- =============================================
CREATE OR ALTER PROCEDURE dbo.Imperium_login_remoto
-- Add the parameters for the stored procedure here
@p_cliente int = null,
@p_contratista int = null,
@p_user_id int = null
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
if (@p_cliente is not null and @p_contratista is not null and @p_user_id is not null)
select clientes.cliente, clientes.nombre_cliente, led_contratistas.contratista, led_contratistas.tipo_contratista,
led_contratistas.id_padron, padrones.nombre_persona, padrones.identificador, padrones.numero, padrones.identificacion,
identificadores.abreviatura, identificadores.country_code, country.country_name,
isnull(clientes.ACCESO_ci, 0) as acceso_ci, isnull(clientes.ACCESO_LED, 0) as acceso_cc,
users.user_id, users.username, users.first_name, users.last_name, users.email, users.cookie_id, users.gender,
convert(varchar,users.birthday,103) as birthday, users.organization, users.position,
LN_contrapartes.contraparte, LN_gestiones.gestion, LN_contraparte_familias.familia,
ISNULL(LN_contrapartes.codigo_idioma, 'spa') AS codigo_idioma,
ISNULL(LN_contrapartes.modalidad_pago, 'CC') AS modalidad_pago
from led_contratistas inner join clientes on led_contratistas.cliente = clientes.cliente
inner join padrones on led_contratistas.id_padron = padrones.id_padron
inner join identificadores on padrones.identificador = identificadores.identificador
inner join country on identificadores.country_code = country.country_code
inner join users on led_contratistas.user_id = users.user_id
left outer join LN_contrapartes ON (led_contratistas.contratista = LN_contrapartes.id_imperium
AND LN_contrapartes.servicio_contratado = 73)
left outer join LN_gestiones ON (LN_contrapartes.contraparte = LN_gestiones.contraparte
AND LN_gestiones.desde <= GETDATE() AND LN_gestiones.hasta >= GETDATE())
left outer join LN_contraparte_familias ON LN_contrapartes.contraparte = LN_contraparte_familias.contraparte
where led_contratistas.contratista = @p_contratista
and led_contratistas.cliente = @p_cliente
and led_contratistas.user_id = @p_user_id
and led_contratistas.estado_contratista = 'A'
and users.active_user = 'Y'
and clientes.estado_cliente = 'A'
END
GO
GO
-- =============================================
-- Author: Luis Prenafeta
-- Create date: 11/11/2019
-- Description: Para validar un login remoto desde backend a la web de contratistas utlizando el cliente, el contratista y el usuario.
-- =============================================
CREATE OR ALTER PROCEDURE dbo.Imperium_login_remoto
-- Add the parameters for the stored procedure here
@p_cliente int = null,
@p_contratista int = null,
@p_user_id int = null
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
if (@p_cliente is not null and @p_contratista is not null and @p_user_id is not null)
select clientes.cliente, clientes.nombre_cliente, led_contratistas.contratista, led_contratistas.tipo_contratista,
led_contratistas.id_padron, padrones.nombre_persona, padrones.identificador, padrones.numero, padrones.identificacion,
identificadores.abreviatura, identificadores.country_code, country.country_name,
isnull(clientes.ACCESO_ci, 0) as acceso_ci, isnull(clientes.ACCESO_LED, 0) as acceso_cc,
users.user_id, users.username, users.first_name, users.last_name, users.email, users.cookie_id, users.gender,
convert(varchar,users.birthday,103) as birthday, users.organization, users.position,
LN_contrapartes.contraparte, LN_gestiones.gestion, LN_contraparte_familias.familia,
ISNULL(LN_contrapartes.codigo_idioma, 'spa') AS codigo_idioma,
ISNULL(LN_contrapartes.modalidad_pago, 'CC') AS modalidad_pago
from led_contratistas inner join clientes on led_contratistas.cliente = clientes.cliente
inner join padrones on led_contratistas.id_padron = padrones.id_padron
inner join identificadores on padrones.identificador = identificadores.identificador
inner join country on identificadores.country_code = country.country_code
inner join users on led_contratistas.user_id = users.user_id
left outer join LN_contrapartes ON (led_contratistas.contratista = LN_contrapartes.id_imperium
AND LN_contrapartes.servicio_contratado = 73)
left outer join LN_gestiones ON (LN_contrapartes.contraparte = LN_gestiones.contraparte
AND LN_gestiones.desde <= GETDATE() AND LN_gestiones.hasta >= GETDATE())
left outer join LN_contraparte_familias ON LN_contrapartes.contraparte = LN_contraparte_familias.contraparte
where led_contratistas.contratista = @p_contratista
and led_contratistas.cliente = @p_cliente
and led_contratistas.user_id = @p_user_id
and led_contratistas.estado_contratista = 'A'
and users.active_user = 'Y'
and clientes.estado_cliente = 'A'
END
GO
Depends On
9Used By
No items found