25 lines
605 B
SQL
25 lines
605 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`clientTaxArea`(vClientId INT, vCompanyId INT)
|
|
RETURNS varchar(25) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
|
|
NOT DETERMINISTIC
|
|
READS SQL DATA
|
|
BEGIN
|
|
/**
|
|
* Devuelve el area de un cliente,
|
|
* intracomunitario, extracomunitario o nacional.
|
|
*
|
|
* @param vClient Id del cliente
|
|
* @param vCompanyFk Compañia desde la que se factura
|
|
* @return Código de area
|
|
*/
|
|
DECLARE vTaxArea VARCHAR(25);
|
|
|
|
SELECT addressTaxArea(defaultAddressFk, vCompanyId)
|
|
INTO vTaxArea
|
|
FROM client
|
|
WHERE id = vClientId;
|
|
|
|
RETURN vTaxArea;
|
|
END$$
|
|
DELIMITER ;
|