7167-testToMaster_2414 #2244

Merged
alexm merged 643 commits from 7167-testToMaster_2414 into master 2024-04-04 05:32:41 +00:00
1 changed files with 6 additions and 4 deletions
Showing only changes of commit 535dd40625 - Show all commits

View File

@ -11,18 +11,20 @@ BEGIN
*/
DECLARE vRate DOUBLE DEFAULT 1;
DECLARE vDated DATE;
DECLARE vExpenseFk INT;
DECLARE vCurrencyFk INT;
DECLARE vExpenseFk VARCHAR(10);
SELECT MAX(rr.dated) INTO vDated
SELECT MAX(rr.dated), ii.currencyFk INTO vDated, vCurrencyFk
FROM referenceRate rr
JOIN invoiceIn ii ON ii.id = vInvoiceInFk
WHERE rr.dated <= ii.issued
AND rr.currencyFk = ii.currencyFk;
IF vDated THEN
IF vDated AND vCurrencyFk THEN
SELECT `value` INTO vRate
FROM referenceRate
WHERE dated = vDated;
WHERE dated = vDated
AND currencyFk = vCurrencyFk;
END IF;
DELETE FROM invoiceInTax WHERE invoiceInFk = vInvoiceInFk;