refs #6446 Delete function nz from db #2022
|
@ -1,16 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `bi`.`nz`(vData DOUBLE)
|
||||
RETURNS double
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
/**
|
||||
* Devuelve 0, si el parámetro es NULL:
|
||||
*/
|
||||
DECLARE vResult DOUBLE;
|
||||
|
||||
SET vResult = IFNULL(vData,0);
|
||||
|
||||
RETURN vResult;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -130,13 +130,13 @@ BEGIN
|
|||
-- Calculamos el porcentaje del recobro para añadirlo al precio de venta
|
||||
UPDATE bi.claims_ratio cr
|
||||
JOIN (
|
||||
SELECT Id_Cliente, nz(SUM(Importe)) AS Greuge
|
||||
SELECT Id_Cliente, IFNULL(SUM(Importe), 0) AS Greuge
|
||||
FROM vn2008.Greuges
|
||||
WHERE Fecha <= util.VN_CURDATE()
|
||||
GROUP BY Id_Cliente
|
||||
) g ON g.Id_Cliente = cr.Id_Cliente
|
||||
SET recobro = GREATEST(0,round(nz(Greuge) /
|
||||
(nz(Consumo) * vMonthToRefund / 12 ) ,3));
|
||||
SET recobro = GREATEST(0,round(IFNULL(Greuge, 0) /
|
||||
(IFNULL(Consumo, 0) * vMonthToRefund / 12 ) ,3));
|
||||
|
||||
-- Protección neonatos
|
||||
UPDATE bi.claims_ratio cr
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`nz`(vQuantity DOUBLE)
|
||||
RETURNS double
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
|
||||
DECLARE vResult DOUBLE;
|
||||
|
||||
SET vResult = IFNULL(vQuantity,0);
|
||||
|
||||
RETURN vResult;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -48,7 +48,7 @@ BEGIN
|
|||
SELECT lc.companyFk,
|
||||
c.id,
|
||||
0,
|
||||
- (NZ(lc.credit) - NZ(lc.debit))
|
||||
- (IFNULL(lc.credit, 0) - IFNULL(lc.debit, 0))
|
||||
FROM tmp.ledgerComparative lc
|
||||
JOIN client c ON c.accountingAccount = lc.account
|
||||
WHERE lc.`date` BETWEEN vDateFrom AND vDateTo
|
||||
|
|
|
@ -60,7 +60,7 @@ BEGIN
|
|||
SELECT lc.companyFk,
|
||||
s.id,
|
||||
0,
|
||||
- (NZ(lc.debit) - NZ(lc.credit))
|
||||
- (IFNULL(lc.debit, 0) - IFNULL(lc.credit, 0))
|
||||
FROM tmp.ledgerComparative lc
|
||||
JOIN supplier s ON s.account = lc.account
|
||||
WHERE lc.`date` BETWEEN vDateFrom AND vDateTo
|
||||
|
|
|
@ -10,7 +10,7 @@ BEGIN
|
|||
|
||||
IF NEW.freightItemFk IS NOT NULL THEN
|
||||
|
||||
UPDATE ticket SET packages = nz(packages) + 1 WHERE id = NEW.ticketFk;
|
||||
UPDATE ticket SET packages = IFNULL(packages, 0) + 1 WHERE id = NEW.ticketFk;
|
||||
|
||||
SELECT IFNULL(MAX(counter),0) +1 INTO intcounter
|
||||
FROM expedition e
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn2008`.`nz`(dblCANTIDAD DOUBLE)
|
||||
RETURNS double
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
|
||||
DECLARE dblRESULT DOUBLE;
|
||||
|
||||
SET dblRESULT = IFNULL(dblCANTIDAD,0);
|
||||
|
||||
RETURN dblRESULT;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
Loading…
Reference in New Issue