24 lines
679 B
SQL
24 lines
679 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`client_getSalesPersonCodeByTicket`(vTicketFk INT)
|
|
RETURNS varchar(3) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
|
|
DETERMINISTIC
|
|
BEGIN
|
|
/**
|
|
* Dado un id ticket, devuelve su comercial.
|
|
* Para más información ir a client_getSalesPerson()
|
|
*
|
|
* @param vClientFk El id del cliente
|
|
* @param vDated Fecha a comprobar
|
|
* @return El código del comercial para la fecha dada
|
|
**/
|
|
DECLARE vClientFk INT;
|
|
DECLARE vDated DATE;
|
|
|
|
SELECT clientFk, shipped
|
|
INTO vClientFk, vDated
|
|
FROM ticket WHERE id = vTicketFk;
|
|
|
|
RETURN client_getSalesPersonCode(vClientFk, vDated);
|
|
END$$
|
|
DELIMITER ;
|