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