salix/db/routines/vn/functions/invoiceOut_getPath.sql

22 lines
474 B
MySQL
Raw Normal View History

DELIMITER $$
2024-08-20 08:06:10 +00:00
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`invoiceOut_getPath`(vSelf INT)
RETURNS varchar(255) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
DETERMINISTIC
BEGIN
DECLARE vIssued DATE;
DECLARE vSerial VARCHAR(15);
SELECT issued, ref
INTO vIssued, vSerial
FROM invoiceOut WHERE id = vSelf;
RETURN CONCAT_WS('/'
,'invoice'
,YEAR(vIssued)
,MONTH(vIssued)
,DAY(vIssued)
,CONCAT(YEAR(vIssued), vSerial, '.pdf')
);
END$$
DELIMITER ;