refactor: refs #7018 Added comment and minor changes
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
e2eddbaef7
commit
1d398a0acf
|
@ -29,7 +29,7 @@ BEGIN
|
|||
LEAVE l;
|
||||
END IF;
|
||||
|
||||
CALL invoiceInTax_insert(vInvoiceInFk);
|
||||
CALL invoiceInTax_recalc(vInvoiceInFk);
|
||||
CALL invoiceInDueDay_recalc(vInvoiceInFk);
|
||||
|
||||
END LOOP;
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInTax_insert`(
|
||||
vSelf INT
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInTax_recalc`(
|
||||
vInvoiceInFk INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Inserta los impuestos de una factura, ajustando por
|
||||
* tasa de cambio y detalles de compra.
|
||||
* Recalcula y actualiza los impuestos de la factura
|
||||
* usando la última tasa de cambio y detalles de compra.
|
||||
*
|
||||
* @param vSelf Id de invoiceInTax
|
||||
* @param vInvoiceInFk Id de factura recibida
|
||||
*/
|
||||
DECLARE vRate DOUBLE DEFAULT 1;
|
||||
DECLARE vDated DATE;
|
||||
|
@ -15,7 +15,7 @@ BEGIN
|
|||
|
||||
SELECT MAX(rr.dated) INTO vDated
|
||||
FROM referenceRate rr
|
||||
JOIN invoiceIn ii ON ii.id = vSelf
|
||||
JOIN invoiceIn ii ON ii.id = vInvoiceInFk
|
||||
WHERE rr.dated <= ii.issued
|
||||
AND rr.currencyFk = ii.currencyFk;
|
||||
|
||||
|
@ -25,7 +25,7 @@ BEGIN
|
|||
WHERE dated = vDated;
|
||||
END IF;
|
||||
|
||||
DELETE FROM invoiceInTax WHERE invoiceInFk = vSelf;
|
||||
DELETE FROM invoiceInTax WHERE invoiceInFk = vInvoiceInFk;
|
||||
|
||||
SELECT id INTO vExpenseFk
|
||||
FROM expense
|
||||
|
@ -56,7 +56,7 @@ BEGIN
|
|||
JOIN buy b ON b.entryFk = e.id
|
||||
LEFT JOIN referenceRate rr ON rr.currencyFk = ii.currencyFk
|
||||
AND rr.dated = ii.issued
|
||||
WHERE ii.id = vSelf
|
||||
WHERE ii.id = vInvoiceInFk
|
||||
HAVING bi IS NOT NULL;
|
||||
END$$
|
||||
DELIMITER ;
|
Loading…
Reference in New Issue