23 lines
695 B
SQL
23 lines
695 B
SQL
DROP PROCEDURE IF EXISTS `vn`.`sale_calculateComponent`;
|
|
|
|
DELIMITER $$
|
|
$$
|
|
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`sale_calculateComponent`(vSale INT, vOption INT)
|
|
proc: BEGIN
|
|
/**
|
|
* Crea tabla temporal para vn.sale_recalcComponent() para recalcular los componentes
|
|
*
|
|
* @param vSale Id de la venta
|
|
* @param vOption indica en que componente pone el descuadre, NULL en casos habituales
|
|
*/
|
|
DROP TEMPORARY TABLE IF EXISTS tmp.recalculateSales;
|
|
CREATE TEMPORARY TABLE tmp.recalculateSales
|
|
SELECT s.id
|
|
FROM sale s
|
|
WHERE s.id = vSale;
|
|
|
|
CALL vn.sale_recalcComponent(vOption);
|
|
|
|
DROP TEMPORARY TABLE tmp.recalculateSales;
|
|
END$$
|
|
DELIMITER ; |