2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` FUNCTION `vn`.`client_getSalesPersonCodeByTicket`(vTicketFk INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
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 ;
|