Merge branch 'master' into test
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Guillermo Bonet 2024-07-02 12:34:51 +02:00
commit edff15662c
2 changed files with 13 additions and 13 deletions

View File

@ -8,7 +8,6 @@ BEGIN
*/ */
DECLARE vTaxRowLimit INT; DECLARE vTaxRowLimit INT;
DECLARE vLines INT; DECLARE vLines INT;
DECLARE vHasDistinctTransactions INT;
SELECT taxRowLimit INTO vTaxRowLimit FROM invoiceInConfig; SELECT taxRowLimit INTO vTaxRowLimit FROM invoiceInConfig;
@ -20,17 +19,5 @@ BEGIN
IF vLines >= vTaxRowLimit THEN IF vLines >= vTaxRowLimit THEN
CALL util.throw (CONCAT('The maximum number of lines is ', vTaxRowLimit)); 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$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -13,6 +13,19 @@ BEGIN
* @param vBookEntry Id de asiento, si es NULL se genera uno nuevo * @param vBookEntry Id de asiento, si es NULL se genera uno nuevo
*/ */
DECLARE vFiscalYear INT; DECLARE vFiscalYear INT;
DECLARE vHasDistinctTransactions INT;
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 = vSelf
AND iis.taxAreaFk = 'CEE'
AND transactionTypeSageFk;
IF vHasDistinctTransactions > 1 THEN
CALL util.throw ('This invoice does not allow different types of transactions');
END IF;
CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn
ENGINE = MEMORY ENGINE = MEMORY