Merge pull request '6626-Restricción-en-invoiceInTax' (!2060) from 6626-Restricción-en-invoiceInTax into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #2060 Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
This commit is contained in:
commit
4a8707e327
|
@ -8,6 +8,7 @@ BEGIN
|
|||
*/
|
||||
DECLARE vTaxRowLimit INT;
|
||||
DECLARE vLines INT;
|
||||
DECLARE vHasDistinctTransactions INT;
|
||||
|
||||
SELECT taxRowLimit INTO vTaxRowLimit FROM invoiceInConfig;
|
||||
|
||||
|
@ -18,6 +19,18 @@ BEGIN
|
|||
|
||||
IF vLines >= vTaxRowLimit THEN
|
||||
CALL util.throw (CONCAT('The maximum number of lines is ', vTaxRowLimit));
|
||||
END IF;
|
||||
END IF;
|
||||
|
||||
SELECT COUNT(DISTINCT transactionTypeSageFk) INTO vHasDistinctTransactions
|
||||
FROM invoiceIn ii
|
||||
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
|
||||
JOIN invoiceInSerial iis ON iis.code = ii.serial
|
||||
WHERE ii.id = vInvoiceInFk
|
||||
AND iis.taxAreaFk = 'CEE'
|
||||
AND transactionTypeSageFk;
|
||||
|
||||
IF vHasDistinctTransactions > 1 THEN
|
||||
CALL util.throw ('This invoice does not allow different types of transactions');
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
Loading…
Reference in New Issue