EXEMPLO_1212310
Database
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
XSTATUSPARCELAPAGAMENTO
Parameters
Name
Type
Mode
@STATUSLAN
int
IN
@VRPARCELA
numeric
IN
@VRPARCELABX
numeric
IN
Definition
CREATE FUNCTION XSTATUSPARCELAPAGAMENTO(@STATUSLAN INT, @VRPARCELA NUMERIC(15,4), @VRPARCELABX NUMERIC(15,4)) RETURNS INT WITH SCHEMABINDING AS BEGIN DECLARE @RETORNO INT IF @STATUSLAN = 0 AND @VRPARCELABX = 0 BEGIN SET @RETORNO = 1 END ELSE IF @STATUSLAN = 0 AND @VRPARCELABX > 0 AND @VRPARCELABX < @VRPARCELA BEGIN SET @RETORNO = 3 END ELSE IF @STATUSLAN = 0 AND @VRPARCELABX > 0 AND @VRPARCELABX >= @VRPARCELA BEGIN SET @RETORNO = 2 END ELSE IF @STATUSLAN = 1 OR @STATUSLAN = 3 OR @STATUSLAN = 5 BEGIN SET @RETORNO = 2 END ELSE IF @STATUSLAN = 4 AND @VRPARCELABX > 0 AND @VRPARCELABX < @VRPARCELA BEGIN SET @RETORNO = 3 END ELSE IF @STATUSLAN = 4 AND @VRPARCELABX > 0 AND @VRPARCELABX >= @VRPARCELA BEGIN SET @RETORNO = 2 END ELSE IF @STATUSLAN = 2 BEGIN SET @RETORNO = 9 END ELSE BEGIN SET @RETORNO = 1 END RETURN @RETORNO END