24 lines
622 B
SQL
24 lines
622 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`client_getSalesPersonByTicket`(vTicketFk INT)
|
|
RETURNS int(11)
|
|
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 id 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_getSalesPerson(vClientFk, vDated);
|
|
END$$
|
|
DELIMITER ;
|