DELIMITER $$
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`ticket_recalcComponents`(vSelf INT, vOption VARCHAR(25))
proc: BEGIN

/**
 * Crea tabla temporal para sale_recalcComponent() para recalcular los componentes
 *
 * @param vSelf Id del ticket
 * @param vOption si no se quiere forzar llamar con NULL
 */

	CREATE OR REPLACE TEMPORARY TABLE tmp.recalculateSales
		SELECT s.id
			FROM sale s
			WHERE s.ticketFk = vSelf;

	CALL sale_recalcComponent(vOption);

	DROP TEMPORARY TABLE tmp.recalculateSales;
END$$
DELIMITER ;
