2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`company_getFiscaldata`(workerFk INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
|
|
|
|
DECLARE vCompanyFk INT;
|
|
|
|
|
|
|
|
SELECT IFNULL(uc.companyFk, rc.defaultCompanyFk)
|
|
|
|
INTO vCompanyFk
|
|
|
|
FROM vn.routeConfig rc
|
2024-07-10 05:46:18 +00:00
|
|
|
LEFT JOIN userMultiConfig uc ON uc.userFk = workerFk;
|
2024-01-15 11:31:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
s.name AS name ,
|
|
|
|
s.NIF AS nif ,
|
|
|
|
s.street AS street ,
|
|
|
|
s.city AS city ,
|
|
|
|
s.postCode AS postCode
|
|
|
|
|
|
|
|
FROM vn.company c
|
|
|
|
JOIN vn.worker w ON w.id = c.workerManagerFk
|
|
|
|
JOIN vn.supplier s ON s.id = c.id
|
|
|
|
WHERE c.id = vCompanyFk;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|