2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`clientTaxArea`(vClientId INT, vCompanyId INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
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 ;
|