25 lines
511 B
SQL
25 lines
511 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`XDiario_checkDate`(vDate DATE)
|
|
proc: BEGIN
|
|
/**
|
|
* Comprueba si la fecha pasada esta en el rango
|
|
* de fecha de contabilidad
|
|
*
|
|
* @param vDate Fecha para comparar
|
|
*/
|
|
DECLARE vIsInvalid BOOL;
|
|
|
|
IF vDate IS NULL THEN
|
|
LEAVE proc;
|
|
END IF;
|
|
|
|
SELECT COUNT(*) = 0 INTO vIsInvalid
|
|
FROM accountingConfig
|
|
WHERE vDate BETWEEN minDate AND maxDate;
|
|
|
|
IF vIsInvalid THEN
|
|
CALL util.throw ('Fecha fuera de rango');
|
|
END IF;
|
|
END$$
|
|
DELIMITER ;
|