6444-MigrateVn2008.intrastat_netoFunctionToVn #1972

Merged
ivanm merged 10 commits from 6444-MigrateVn2008.intrastat_netoFunctionToVn into dev 2024-02-06 13:21:24 +00:00
1 changed files with 3 additions and 3 deletions
Showing only changes of commit 438af34d73 - Show all commits

View File

@ -1,7 +1,7 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`intrastat_estimateNet`( CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`intrastat_estimateNet`(
vSelf INT, vSelf INT,
vUnits INT vStems INT
) )
RETURNS double RETURNS double
DETERMINISTIC DETERMINISTIC
@ -11,12 +11,12 @@ BEGIN
* datos históricos de facturas intrastat. * datos históricos de facturas intrastat.
* *
* @param vSelf Id de intrastat * @param vSelf Id de intrastat
* @param vUnits Número de unidades * @param vStems Número de unidades
* @return vNet * @return vNet
*/ */
DECLARE vNet DOUBLE; DECLARE vNet DOUBLE;
SELECT ROUND(vUnits / (SUM(average) / COUNT(average)), 2) INTO vNet SELECT ROUND(vStems / (SUM(average) / COUNT(average)), 2) INTO vNet
FROM ( FROM (
SELECT *, stems / net average SELECT *, stems / net average
FROM invoiceInIntrastat FROM invoiceInIntrastat