This commit is contained in:
parent
7c4032c859
commit
bfd2b5aebb
|
@ -13,26 +13,12 @@ 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 vDistinctTransactions INT;
|
|
||||||
DECLARE vHasRepeatedTransactions BOOL;
|
DECLARE vHasRepeatedTransactions BOOL;
|
||||||
|
|
||||||
SELECT COUNT(DISTINCT iit.transactionTypeSageFk) INTO vDistinctTransactions
|
|
||||||
FROM invoiceIn ii
|
|
||||||
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
|
|
||||||
JOIN invoiceInSerial iis ON iis.code = ii.serial
|
|
||||||
WHERE iit.invoiceInFk = vSelf
|
|
||||||
AND iis.taxAreaFk = 'CEE'
|
|
||||||
AND iit.transactionTypeSageFk;
|
|
||||||
|
|
||||||
IF vDistinctTransactions > 1 THEN
|
|
||||||
CALL util.throw ('This invoice does not allow different types of transactions');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
SELECT TRUE INTO vHasRepeatedTransactions
|
SELECT TRUE INTO vHasRepeatedTransactions
|
||||||
FROM invoiceInTax
|
FROM invoiceInTax
|
||||||
WHERE invoiceInFk = vSelf
|
WHERE invoiceInFk = vSelf
|
||||||
GROUP BY transactionTypeSageFk
|
HAVING COUNT(DISTINCT transactionTypeSageFk) > 1
|
||||||
HAVING COUNT(transactionTypeSageFk) > 1
|
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
|
|
||||||
IF vHasRepeatedTransactions THEN
|
IF vHasRepeatedTransactions THEN
|
||||||
|
|
Loading…
Reference in New Issue