7806_devToTest_2332 #2801
|
@ -12,6 +12,7 @@ BEGIN
|
||||||
DECLARE vInvoiceFk INT;
|
DECLARE vInvoiceFk INT;
|
||||||
DECLARE vBookEntry INT;
|
DECLARE vBookEntry INT;
|
||||||
DECLARE vFiscalYear INT;
|
DECLARE vFiscalYear INT;
|
||||||
|
DECLARE vIncorrectInvoiceInDueDay INT;
|
||||||
|
|
||||||
DECLARE vInvoicesIn CURSOR FOR
|
DECLARE vInvoicesIn CURSOR FOR
|
||||||
SELECT DISTINCT e.invoiceInFk
|
SELECT DISTINCT e.invoiceInFk
|
||||||
|
@ -24,6 +25,19 @@ BEGIN
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
|
|
||||||
|
SELECT GROUP_CONCAT(ii.id) INTO vIncorrectInvoiceInDueDay
|
||||||
|
FROM invoiceInDueDay iidd
|
||||||
|
JOIN invoiceIn ii ON iidd.invoiceInFk = ii.id
|
||||||
|
JOIN `entry` e ON e.invoiceInFk = ii.id
|
||||||
|
JOIN duaEntry de ON de.entryFk = e.id
|
||||||
|
JOIN invoiceInConfig iic
|
||||||
|
WHERE de.duaFk = vDuaFk
|
||||||
|
AND iidd.dueDated <= util.VN_CURDATE() + INTERVAL iic.dueDateMarginDays DAY;
|
||||||
|
|
||||||
|
IF vIncorrectInvoiceInDueDay THEN
|
||||||
|
CALL util.throw(CONCAT('Incorrect due date, invoice: ', vIncorrectInvoiceInDueDay));
|
||||||
|
END IF;
|
||||||
|
|
||||||
UPDATE invoiceIn ii
|
UPDATE invoiceIn ii
|
||||||
JOIN entry e ON e.invoiceInFk = ii.id
|
JOIN entry e ON e.invoiceInFk = ii.id
|
||||||
JOIN duaEntry de ON de.entryFk = e.id
|
JOIN duaEntry de ON de.entryFk = e.id
|
||||||
|
|
Loading…
Reference in New Issue