Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
7| Name | Data Type | Length | Description |
|---|---|---|---|
| @id_grupo | int | 4 | |
| @liquidez_corriente | decimal | 9 | |
| @solvencia_patrimonial | decimal | 9 | |
| @endeudamiento_corriente | decimal | 9 | |
| @capital_de_trabajo_activo | decimal | 9 | |
| @rentabilidad_bruta | decimal | 9 | |
| @utilidad_neta | decimal | 9 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER PROCEDURE dbo.calcular_score_contable
@id_grupo int,
@liquidez_corriente decimal(15,2),
@solvencia_patrimonial decimal(15,2),
@endeudamiento_corriente decimal(15,2),
@capital_de_trabajo_activo decimal(15,2),
@rentabilidad_bruta decimal(15,2),
@utilidad_neta decimal(15,2)
AS
BEGIN
declare @o_liquidez_corriente decimal(15,2)
declare @o_solvencia_patrimonial decimal(15,2)
declare @o_endeudamiento_corriente decimal(15,2)
declare @o_capital_de_trabajo_activo decimal(15,2)
declare @o_rentabilidad_bruta decimal(15,2)
declare @o_utilidad_neta decimal(15,2)
SET NOCOUNT ON;
set @o_liquidez_corriente = (select valor from score where @liquidez_corriente between cant_desde and cant_hasta and id_grupo = @id_grupo and codigo = 'LIQUIDEZ')
set @o_solvencia_patrimonial = (select valor from score where @solvencia_patrimonial between cant_desde and cant_hasta and id_grupo = @id_grupo and codigo = 'SOLVENCIA')
set @o_endeudamiento_corriente = (select valor from score where @endeudamiento_corriente between cant_desde and cant_hasta and id_grupo = @id_grupo and codigo = 'ENDEUDAMIENTO')
set @o_capital_de_trabajo_activo = (select valor from score where @capital_de_trabajo_activo between cant_desde and cant_hasta and id_grupo = @id_grupo and codigo = 'CAPITAL')
set @o_rentabilidad_bruta = (select valor from score where @rentabilidad_bruta between cant_desde and cant_hasta and id_grupo = @id_grupo and codigo = 'RENTABILIDAD')
set @o_utilidad_neta = (select top 1 valor from score where @utilidad_neta between cant_desde and cant_hasta and id_grupo = @id_grupo and codigo = 'UTILIDAD')
select isnull(@o_liquidez_corriente,0) as liquidez_corriente,isnull(@o_solvencia_patrimonial,0) as solvencia_patrimonial,isnull(@o_endeudamiento_corriente,0) as endeudamiento_corriente,isnull(@o_capital_de_trabajo_activo,0) as capital_de_trabajo_activo,isnull(@o_rentabilidad_bruta,0) as rentabilidad_bruta,isnull(@o_utilidad_neta,0) as utilidad_neta
END
GO
GO
CREATE OR ALTER PROCEDURE dbo.calcular_score_contable
@id_grupo int,
@liquidez_corriente decimal(15,2),
@solvencia_patrimonial decimal(15,2),
@endeudamiento_corriente decimal(15,2),
@capital_de_trabajo_activo decimal(15,2),
@rentabilidad_bruta decimal(15,2),
@utilidad_neta decimal(15,2)
AS
BEGIN
declare @o_liquidez_corriente decimal(15,2)
declare @o_solvencia_patrimonial decimal(15,2)
declare @o_endeudamiento_corriente decimal(15,2)
declare @o_capital_de_trabajo_activo decimal(15,2)
declare @o_rentabilidad_bruta decimal(15,2)
declare @o_utilidad_neta decimal(15,2)
SET NOCOUNT ON;
set @o_liquidez_corriente = (select valor from score where @liquidez_corriente between cant_desde and cant_hasta and id_grupo = @id_grupo and codigo = 'LIQUIDEZ')
set @o_solvencia_patrimonial = (select valor from score where @solvencia_patrimonial between cant_desde and cant_hasta and id_grupo = @id_grupo and codigo = 'SOLVENCIA')
set @o_endeudamiento_corriente = (select valor from score where @endeudamiento_corriente between cant_desde and cant_hasta and id_grupo = @id_grupo and codigo = 'ENDEUDAMIENTO')
set @o_capital_de_trabajo_activo = (select valor from score where @capital_de_trabajo_activo between cant_desde and cant_hasta and id_grupo = @id_grupo and codigo = 'CAPITAL')
set @o_rentabilidad_bruta = (select valor from score where @rentabilidad_bruta between cant_desde and cant_hasta and id_grupo = @id_grupo and codigo = 'RENTABILIDAD')
set @o_utilidad_neta = (select top 1 valor from score where @utilidad_neta between cant_desde and cant_hasta and id_grupo = @id_grupo and codigo = 'UTILIDAD')
select isnull(@o_liquidez_corriente,0) as liquidez_corriente,isnull(@o_solvencia_patrimonial,0) as solvencia_patrimonial,isnull(@o_endeudamiento_corriente,0) as endeudamiento_corriente,isnull(@o_capital_de_trabajo_activo,0) as capital_de_trabajo_activo,isnull(@o_rentabilidad_bruta,0) as rentabilidad_bruta,isnull(@o_utilidad_neta,0) as utilidad_neta
END
GO
Depends On
1Used By
No items found