feat: refs #7382 Changes
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
d1ef1c80f8
commit
2278b9a05a
|
@ -13,20 +13,31 @@ BEGIN
|
|||
* @param vBookEntry Id de asiento, si es NULL se genera uno nuevo
|
||||
*/
|
||||
DECLARE vFiscalYear INT;
|
||||
DECLARE vHasDistinctTransactions INT;
|
||||
DECLARE vDistinctTransactions INT;
|
||||
DECLARE vHasRepeatedTransactions BOOL;
|
||||
|
||||
SELECT COUNT(DISTINCT transactionTypeSageFk) INTO vHasDistinctTransactions
|
||||
FROM invoiceIn ii
|
||||
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
|
||||
SELECT COUNT(DISTINCT iit.transactionTypeSageFk) INTO vDistinctTransactions
|
||||
FROM invoiceInTax iit
|
||||
JOIN invoiceInSerial iis ON iis.code = ii.serial
|
||||
WHERE ii.id = vSelf
|
||||
WHERE iit.invoiceInFk = vSelf
|
||||
AND iis.taxAreaFk = 'CEE'
|
||||
AND transactionTypeSageFk;
|
||||
AND iit.transactionTypeSageFk;
|
||||
|
||||
IF vHasDistinctTransactions > 1 THEN
|
||||
IF vDistinctTransactions > 1 THEN
|
||||
CALL util.throw ('This invoice does not allow different types of transactions');
|
||||
END IF;
|
||||
|
||||
SELECT TRUE INTO vHasRepeatedTransactions
|
||||
FROM invoiceInTax
|
||||
WHERE invoiceInFk = vSelf
|
||||
GROUP BY transactionTypeSageFk
|
||||
HAVING COUNT(transactionTypeSageFk) > 1
|
||||
LIMIT 1;
|
||||
|
||||
IF vHasRepeatedTransactions THEN
|
||||
CALL util.throw ('This invoice contains repeated types of transactions');
|
||||
END IF;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn
|
||||
ENGINE = MEMORY
|
||||
SELECT ii.bookEntried,
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE vn.invoiceInTax ADD CONSTRAINT invoiceInTax_unique UNIQUE KEY (invoiceInFk,expenseFk);
|
Loading…
Reference in New Issue