dbo.LN_limite_credito

Description

Properties

Name Value
File Collation
File Group
Filestream File Group
Is Partitioned

False

Partitioned Column
Partition Scheme
File Groups
Filestream Partition Scheme
Filestream File Groups
Heap

True

Full Text Catalog
Full Text
Compression NONE
Row Count (~) 585
Created 3/20/2019 12:03:22 PM
Last Modified 11/1/2019 3:47:51 PM

Columns

36
Key Name Data Type Length Precision Scale Not Null Identity Rule Default Computed Persisted Description
contraparte int 4 10 0

True

False

False

gestion int 4 10 0

True

False

False

post_activo_caja_bancos decimal 13 20 2

False

False

False

post_activo_inversiones decimal 13 20 2

False

False

False

post_activo_corriente decimal 13 20 2

False

False

False

post_activo_total decimal 13 20 2

False

False

False

post_pasivo_corriente decimal 13 20 2

False

False

False

post_prestamos_corrientes decimal 13 20 2

False

False

False

post_prestamos_no_corrientes decimal 13 20 2

False

False

False

post_pasivo_total decimal 13 20 2

False

False

False

post_patrimonio decimal 13 20 2

False

False

False

post_resultados_acumulados decimal 13 20 2

False

False

False

post_ventas decimal 13 20 2

False

False

False

post_compras decimal 13 20 2

False

False

False

post_ganancia decimal 13 20 2

False

False

False

post_ebitda decimal 13 20 2

False

False

False

post_otros_ingresos decimal 13 20 2

False

False

False

post_otros_egresos decimal 13 20 2

False

False

False

post_patrimonio_integrado decimal 13 20 2

False

False

False

post_capital_trabajo decimal 13 20 2

False

False

False

post_rel_capital_trabajo_pasivo decimal 13 20 2

False

False

False

post_rel_capital_trabajo_ventas decimal 13 20 2

False

False

False

post_rel_compras_ventas decimal 13 20 2

False

False

False

post_rentabilidad_final decimal 13 20 2

False

False

False

post_resultado_operativo decimal 13 20 2

False

False

False

post_rentabilidad_operativa decimal 13 20 2

False

False

False

post_rel_ebitda_ventas decimal 13 20 2

False

False

False

post_fondos decimal 13 20 2

False

False

False

maximo_recomendado decimal 13 20 2

False

False

False

ultimo_aprobado decimal 13 20 2

False

False

False

ultimo_aprobado_fecha date 3 10 0

False

False

False

recomendacion text 0 0

False

False

False

ultimo_aprobado_usd decimal 13 20 2

False

False

False

ultimo_aprobado_usd_fecha date 3 10 0

False

False

False

visible bit 1 1 0

False

(0)

False

False

informe int 4 10 0

False

False

False

Indexes

1
Key Name Columns Unique Type Description
PK__LN_limit__3CEA362C7014275C contraparte, gestion

True

Triggers

2
Name ANSI Nulls ON Quoted Identifier ON On Not For Replication Description
trig_insert_limite_credito

True

True

AFTER INSERT

False

trig_update_limite_credito

True

True

AFTER UPDATE

False

SQL Script

Copy
CREATE TABLE dbo.LN_limite_credito (
  contraparte int NOT NULL,
  gestion int NOT NULL,
  post_activo_caja_bancos decimal(20, 2) NULL,
  post_activo_inversiones decimal(20, 2) NULL,
  post_activo_corriente decimal(20, 2) NULL,
  post_activo_total decimal(20, 2) NULL,
  post_pasivo_corriente decimal(20, 2) NULL,
  post_prestamos_corrientes decimal(20, 2) NULL,
  post_prestamos_no_corrientes decimal(20, 2) NULL,
  post_pasivo_total decimal(20, 2) NULL,
  post_patrimonio decimal(20, 2) NULL,
  post_resultados_acumulados decimal(20, 2) NULL,
  post_ventas decimal(20, 2) NULL,
  post_compras decimal(20, 2) NULL,
  post_ganancia decimal(20, 2) NULL,
  post_ebitda decimal(20, 2) NULL,
  post_otros_ingresos decimal(20, 2) NULL,
  post_otros_egresos decimal(20, 2) NULL,
  post_patrimonio_integrado decimal(20, 2) NULL,
  post_capital_trabajo decimal(20, 2) NULL,
  post_rel_capital_trabajo_pasivo decimal(20, 2) NULL,
  post_rel_capital_trabajo_ventas decimal(20, 2) NULL,
  post_rel_compras_ventas decimal(20, 2) NULL,
  post_rentabilidad_final decimal(20, 2) NULL,
  post_resultado_operativo decimal(20, 2) NULL,
  post_rentabilidad_operativa decimal(20, 2) NULL,
  post_rel_ebitda_ventas decimal(20, 2) NULL,
  post_fondos decimal(20, 2) NULL,
  maximo_recomendado decimal(20, 2) NULL,
  ultimo_aprobado decimal(20, 2) NULL,
  ultimo_aprobado_fecha date NULL,
  recomendacion text NULL,
  ultimo_aprobado_usd decimal(20, 2) NULL,
  ultimo_aprobado_usd_fecha date NULL,
  visible bit NULL DEFAULT (0),
  informe int NULL,
  PRIMARY KEY NONCLUSTERED (contraparte, gestion) WITH (FILLFACTOR = 80)
)
ON [PRIMARY]
TEXTIMAGE_ON [PRIMARY]
GO

SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE OR ALTER triGGER dbo.trig_insert_limite_credito ON dbo.LN_limite_credito FOR INSERT
   
AS 
BEGIN
 -- SET NOCOUNT ON added to prevent extra result sets from
 -- interfering with SELECT statements.
 SET NOCOUNT ON;

    -- Insert statements for trigger here

 DECLARE @contraparte int, @gestion int,
   @patrimonio decimal(20,2), @resultados_acumulados decimal(20,2), @activo_corriente decimal(20,2),
   @pasivo_corriente decimal(20,2), @pasivo_total decimal(20,2), @ventas decimal(20,2), @compras decimal(20,2),
   @ganancia decimal(20,2), @otros_ingresos decimal(20,2), @otros_egresos decimal(20,2), @ebitda decimal(20,2),
   @activo_caja_bancos decimal(20,2), @activo_inversiones decimal(20,2)


 SELECT 
   @contraparte = inserted.contraparte,
   @gestion = inserted.gestion,
   @patrimonio = inserted.post_patrimonio,
   @resultados_acumulados = inserted.post_resultados_acumulados,
   @activo_corriente = inserted.post_activo_corriente,
   @pasivo_corriente = inserted.post_pasivo_corriente,
   @pasivo_total = inserted.post_pasivo_total,
   @ventas = inserted.post_ventas,
   @compras = inserted.post_compras,
   @ganancia = inserted.post_ganancia,
   @otros_ingresos = inserted.post_otros_ingresos,
   @otros_egresos = inserted.post_otros_egresos,
   @ebitda = inserted.post_ebitda,
   @activo_caja_bancos = inserted.post_activo_caja_bancos,
   @activo_inversiones = inserted.post_activo_inversiones

 FROM inserted



    /*UPDATE LN_limite_credito SET
    
     post_patrimonio_integrado = ISNULL(@patrimonio,0) - ISNULL(@resultados_acumulados,0),
     post_capital_trabajo = ISNULL(@activo_corriente,0) - ISNULL(@pasivo_corriente,0),
     post_rel_capital_trabajo_pasivo = iif(@pasivo_total > 0, (ISNULL(@activo_corriente,0) - ISNULL(@pasivo_corriente,0)) / @pasivo_total * 100, NULL),
     post_rel_capital_trabajo_ventas = iif(@ventas > 0, (ISNULL(@activo_corriente,0) - ISNULL(@pasivo_corriente,0)) / @ventas * 100, NULL),
     post_rel_compras_ventas = iif(@ventas > 0 AND @compras > 0, @compras / @ventas * 100, NULL),
     post_rentabilidad_final = iif(@ganancia > 0 AND @ventas > 0, @ganancia / @ventas * 100, NULL),
     post_resultado_operativo = ISNULL(@ganancia, 0) + ISNULL(@otros_egresos, 0) - ISNULL(@otros_ingresos, 0),
     post_rentabilidad_operativa = iif(@ventas > 0, (ISNULL(@ganancia, 0) + ISNULL(@otros_egresos, 0) - ISNULL(@otros_ingresos, 0)) / @ventas * 100, NULL),
     post_rel_ebitda_ventas = iif(@ventas > 0 AND @ebitda > 0, @ebitda / @ventas * 100, NULL),
     post_fondos = ISNULL(@activo_caja_bancos, 0) + ISNULL(@activo_inversiones, 0)
    
     WHERE
     LN_limite_credito.contraparte = @contraparte
     AND LN_limite_credito.gestion = @gestion*/



END
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE OR ALTER triGGER dbo.trig_update_limite_credito ON dbo.LN_limite_credito FOR UPDATE
   
AS 
BEGIN
 -- SET NOCOUNT ON added to prevent extra result sets from
 -- interfering with SELECT statements.
 SET NOCOUNT ON;

    -- Insert statements for trigger here

 DECLARE @contraparte int, @gestion int,
   @patrimonio decimal(20,2), @resultados_acumulados decimal(20,2), @activo_corriente decimal(20,2),
   @pasivo_corriente decimal(20,2), @pasivo_total decimal(20,2), @ventas decimal(20,2), @compras decimal(20,2),
   @ganancia decimal(20,2), @otros_ingresos decimal(20,2), @otros_egresos decimal(20,2), @ebitda decimal(20,2),
   @activo_caja_bancos decimal(20,2), @activo_inversiones decimal(20,2)


 SELECT 
   @contraparte = inserted.contraparte,
   @gestion = inserted.gestion,
   @patrimonio = inserted.post_patrimonio,
   @resultados_acumulados = inserted.post_resultados_acumulados,
   @activo_corriente = inserted.post_activo_corriente,
   @pasivo_corriente = inserted.post_pasivo_corriente,
   @pasivo_total = inserted.post_pasivo_total,
   @ventas = inserted.post_ventas,
   @compras = inserted.post_compras,
   @ganancia = inserted.post_ganancia,
   @otros_ingresos = inserted.post_otros_ingresos,
   @otros_egresos = inserted.post_otros_egresos,
   @ebitda = inserted.post_ebitda,
   @activo_caja_bancos = inserted.post_activo_caja_bancos,
   @activo_inversiones = inserted.post_activo_inversiones

 FROM inserted



    /*UPDATE LN_limite_credito SET
    
     post_patrimonio_integrado = ISNULL(@patrimonio,0) - ISNULL(@resultados_acumulados,0),
     post_capital_trabajo = ISNULL(@activo_corriente,0) - ISNULL(@pasivo_corriente,0),
     post_rel_capital_trabajo_pasivo = iif(@pasivo_total > 0, (ISNULL(@activo_corriente,0) - ISNULL(@pasivo_corriente,0)) / @pasivo_total * 100, NULL),
     post_rel_capital_trabajo_ventas = iif(@ventas > 0, (ISNULL(@activo_corriente,0) - ISNULL(@pasivo_corriente,0)) / @ventas * 100, NULL),
     post_rel_compras_ventas = iif(@ventas > 0 AND @compras > 0, @compras / @ventas * 100, NULL),
     post_rentabilidad_final = iif(@ganancia > 0 AND @ventas > 0, @ganancia / @ventas * 100, NULL),
     post_resultado_operativo = ISNULL(@ganancia, 0) + ISNULL(@otros_egresos, 0) - ISNULL(@otros_ingresos, 0),
     post_rentabilidad_operativa = iif(@ventas > 0, (ISNULL(@ganancia, 0) + ISNULL(@otros_egresos, 0) - ISNULL(@otros_ingresos, 0)) / @ventas * 100, NULL),
     post_rel_ebitda_ventas = iif(@ventas > 0 AND @ebitda > 0, @ebitda / @ventas * 100, NULL),
     post_fondos = ISNULL(@activo_caja_bancos, 0) + ISNULL(@activo_inversiones, 0)
    
     WHERE
     LN_limite_credito.contraparte = @contraparte
     AND LN_limite_credito.gestion = @gestion*/



END
GO

Depends On

1
  • Fidelitas